Using Javascript to display content if certain criteria is met -


I have 2 sets of banner codes to display banners:

1) Ad server code Blocked by Adblock 2) Simple HTML banner entry which does not block adblock

My question is:

How to add plain JavaScript to Javascript (or something) And, for that matter) can use the banner code if AdBlock has been detected, for reference This adblock finder code was found:

  document.write ('& lt; div id = "tester" style = "display: none" & gt; an advertisemen & lt; / div & Gt; '); & Lt; Script type = "text / javascript" src = "advert.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; If (document.getElementById ("tester") == undefined) {document.write ('text adblock is active to display text'); }   

Using the code you provided:

 < Code> Document.write ('& lt; div id = "tester" style = "display: none" & gt; One advertiser & lt; / div & gt;'); & Lt; Script type = "text / javascript" src = "advert.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; If (document.getElementById ("tester") == undefined) {document.write ('HTML banner code here'); } Else {docuement.write ('Ad server code here')}  

Both your HTML banner and ad server code will be in javascript, which writes a single in an original HTML file, specific DOM Point example:


Comments