Advertising blocker in javascript
I am working on an ad blocker coded in javascript. I have 开发者_JAVA技巧some code from an old project, what I do so far is to loop on all the iframes and I search if the src url match a list like:
/http:\/\/[a-zA-Z0-9-_\.]*mediaplex\.com/,
/http:\/\/ad\.yieldmanager\.com/,
/http:\/\/ad\.zanox\.com/,
Is this a good way to do it or will I miss too many ads that doesnt work this way?
Also is there something like this already made so I can check that code? I was checking a few firefox extensions like ad_blocker-0.6 and adblock_plus-1.2.2 but they are different from what I want to do, they mostly have "event listeners", I need to work with the already displayed code and I use pure js without any lib or framework. I get the iframes using DOM.
Use CSS to simplify the ad blocker. Here are some classic solutions:
Floopymoose Ad Blocker
Gozer Ad Blocker
FlashBlock
精彩评论