ghostery / adblocker

Efficient embeddable adblocker library

Home Page:https://www.ghostery.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use this in react? Readme states only how to start engine.

animemandir opened this issue · comments

I have a react web app. It has a iframes which contain ads.

So how do I go around it? I want to block all ads on a specific page, say- home/[id].js which has iframe whose sources are loaded from api.
How do I start engine and block all ads on that page?

commented

Hi @animemandir,

Thanks for reaching out. There is nothing out of the box to block ads from the page itself (at least no easy way). If you are using the adblocker from the page itself to block ads loaded in an iframe, your best bet might be to inject some JavaScript in the iframe to mock fetch and XMLHttpRequest APIs and maybe more.

The adblocker is usually operating from a browser extension, which offers better APIs to intercept and block requests.

Best,