Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load event for iFrame not fired in IE

Tags:

Why is the load event not fired in IE for iFrames?

Please take a look at this example.

Work perfectly as expected in FF and Chrome, but IE fails.

like image 611
Muleskinner Avatar asked Dec 02 '10 11:12

Muleskinner


People also ask

Does iframe work on IE?

iframe is transparent in Edge,chrome and works fine on IE - Microsoft Q&A.

Can I use iframe onload?

We can use the onload event handler of the iframe HTML tag. The event fires once all the elements in the iframe is loaded. These include a loading of scripts, images, links, subframes etc. It accepts a function declaration as a parameter that we mention in the HTML tag.

How check iframe is loaded or not in JavaScript?

To check if iframe is loaded or it has a content with JavaScript, we can set the iframe's onload property to a function that runs when the iframe is loaded. document. querySelector("iframe"). onload = () => { console.

Does iframe block page load?

Whereas iframes are typically used to include one HTML page within another, the Script in Iframe technique leverages them to load JavaScript without blocking, as shown by the Script in Iframe example.


1 Answers

I think for iframes in Internet Explorer you can't set that event handler (onload) programmatically, you need to specify it in your markup.

Something like:

<iframe id="myFrame" onload="myFunction();"></iframe> 

Otherwise IE is just going to ignore the function.

like image 138
Seis Avatar answered Sep 17 '22 14:09

Seis