Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Simple Adblocker

Post Reply
thefunkyjoint
Posts: 458
Joined: Thu Aug 10, 2017 12:40 pm

Simple Adblocker

Post by thefunkyjoint »

Hi,

I'm trying to implement a simple adblocker on my TChromium instance. To do so, i want to block the connection to specific domains, like 'ads.facebook', 'googleads.com' and so on.

Is there any event where i can catch every url a page is requesting , check the url and block the ones i want ?

Thanks
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Simple Adblocker

Post by salvadordf »

Hi,

Use the TChromium.OnBeforeResourceLoad event and set the "Result" parameter to RV_CANCEL when you want to block that resource.

These are the details for that event :
https://magpcss.org/ceforum/apidocs3/pr ... llback%3E)
thefunkyjoint
Posts: 458
Joined: Thu Aug 10, 2017 12:40 pm

Re: Simple Adblocker

Post by thefunkyjoint »

Hello Salvador !

I could not find this event, but could find this :

BeforeNavigate2

Can this be used instead ?
thefunkyjoint
Posts: 458
Joined: Thu Aug 10, 2017 12:40 pm

Re: Simple Adblocker

Post by thefunkyjoint »

Sorry, i was looking at the wrong component, i found it now :D
Post Reply