Reputation: 1336
I have a malvertising problem.
My website contains a bunch of ad slots that we fill from 2-3 ad networks.
Recently there has been a surge of plugins / extensions that sit in the browser (user some how installed them) and when the page loads they look at all such ad slots and inject their own ad code into it.
This is having an impact on my revenue & more important they inject porn ads that is making me loose readers.
Now one approach that i have is to somehow protect the ad code, Make the div that is encapsulating it non changeable. (can this be done ?) Or any other approach / views on how to stop this ?
UPDATE 1: As @ShivaRaptor pointed out due to cross-domain security restriction, parent JS cannot modify DOM structure in iframe document. - So that takes care of the malvertizers who try to modify the DOM of page.
Now there is one more case left - malvertizers who just detect the location on the div and paste their ad on top of my ad slots. Will making the z-index of the containing DIV max 32 bit value stop them form doing this ?
Upvotes: 1
Views: 590
Reputation: 40671
Once the request for your web page is filled and your server sends it, that's the end of control you have over it. On the client side, any and all of it can be changed and there's nothing you can do about it.
That's the nature of the web.
Upvotes: 0
Reputation: 707326
If this mal-ware is plugins or extensions in the browser, then there is nothing you can do to keep them from modifying your page. When the user allowed them to be installed in the browser, they opened the door to any type of page modification.
First off, I'd suggest that you really ought to collect some metrics on the actual size of the problem to determine whether it's really something you should spend engineering time on or not. I have no doubt that you have real reports of this happening, but do you know what percent of your viewers this is actually afflicting? If it's a tiny portion of your viewers, then your time may be better spent investing in your site to attract more viewers than trying to deal with this specific piece of mal-ware.
The things I can think of that you could do are:
Upvotes: 2