Forum Moderators: open
So, how can I detect if either iframes or javascript doesn't work in a browser, and load a default static banner in those browsers?
In pseudocode:
if (js == true AND iframes = true)
... {load AdSense code}
else
...{load a default banner}
Keep in mind you can't tamper with the AdSense code itself. Thanks!
So you only need to detect iframes in the script, and you also need to put the default banner in a <noscript> tag.
Revised pseudocode:
<script>
if (iframes == true) {
...(load AdSense code)
} else {
...(load a default banner)
}
</script>
<noscript>
...(a default banner)
</noscript>
I suppose I could try to insert a small iframe of my own, and if it worked, then I would know the browser supports iframes, but that seems awfully round-about. Anyone know of a better way (that doesn't rely on user-agent strings)?