Page 1 of 1

Simple Adblocker

Posted: Fri Aug 16, 2019 12:20 am
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

Re: Simple Adblocker

Posted: Fri Aug 16, 2019 7:05 am
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)

Re: Simple Adblocker

Posted: Fri Aug 16, 2019 11:26 am
by thefunkyjoint
Hello Salvador !

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

BeforeNavigate2

Can this be used instead ?

Re: Simple Adblocker

Posted: Fri Aug 16, 2019 11:34 am
by thefunkyjoint
Sorry, i was looking at the wrong component, i found it now :D