Here is the situation:
- A page (
iframe.html) has an iframe loading another page (iframe-content.html). - An JavaScript error might happen when
iframe-content.htmlis loaded in the iframe. - I'd like that exception to be visible to the browser (e.g. shown in Firefox error console, or Firebug).
Here is what I see:
- When
iframe.htmlis initially loaded, and loadsiframe-content.htmlwithsrc="iframe-content.html", the JavaScript exception shows in Firebug. - However, if the page is loaded in JavaScript (
document.getElementById('iframe').src = 'iframe-content.html'), the exception doesn't show.
You can reproduce this by going to:
- http://avernet.googlepages.com/iframe.html with Firefox.
- You'll see the exception as
iframe-content.htmlis loaded. - Click on the button: the content of the iframe is loaded again, but this time the exception doesn't show in Firebug.
Is there a way at #3 to have the exception show, instead of it being silently ignored? (You can't use a try/catch around the JS code that sets the src, as this code returns immediately before the page is loaded in the iframe.)