Detect if ads are loaded [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this questionHow do I detect if ads are loaded and redirect if not loaded ? Assuming I have a tag and javascript is enabled, can this be tampered ?
Two ideas come to mind. If there's no JavaScript enabled on the page, your ads probably won't load. So you could do something like this:
<noscript>
<meta http-equiv="refresh" content="0;url=http://example.com/noads" />
</noscript>
Some people have ad blockers, so that they can still have JS without ads. So you could create a variable in inline JS (var ads_loaded = false;
), and then switch its value in the file that loads the ads (load_ads(); ads_loaded = true;
). The idea is that, if the ads_loaded
variable is changed, then everything else in the file was probably executed, as well.
精彩评论