Jump to content

If Iframe Blocked show image..?


cyfer65

Recommended Posts

Is there anyway to check if an i frame is blocked on my page and if so show an image in its place...?im trying to work out some code that if either javascript is off or adblock is enabled to show and image over or in place of the blocked iframe..how could i do this..?

Link to comment
Share on other sites

JavascriptCheck to see if the iframe exists. As far as I know, ad-blockers remove the element from the page.Give your iframe an ID and check to see if the element exists by checking its boolean value:

window.onload = function() {  if(!document.getElementById("myFrame")) {	// Place an image in the document with the DOM  }}

You can't manipulate the page if Javascript is off, but you can place something on the page that's removed if Javascript is enabled

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...