3

Sites like youtube block the displaying of their site from iframes.

I'd like to detect when an iframe fails to load due to blocking from the destination site, and instead load a placeholder address in the iframe.

Right now you get an empty iframe or a server error page, which is not user friendly.

<iframe src="https://www.youtube.com" scrolling="yes"></iframe>

How do I do that?

Amy Neville
  • 10,067
  • 13
  • 58
  • 94
  • I was thinking of using a web-bug to see if the frame loaded or not... Or maybe a callback from the iframe to the main page. – ebyrob Dec 08 '15 at 15:22
  • 4
    I believe the only reliable way to do this, is to fetch the url serverside, and check for `x-frame-options` headers. For obvious reasons javascript is very limited when it comes to framebusting. – adeneo Dec 08 '15 at 15:23
  • thanks guys.....looks like I'm in for a fun ajax round trip of doom then......yay – Amy Neville Dec 09 '15 at 09:03

0 Answers0