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.
iframe is transparent in Edge,chrome and works fine on IE - Microsoft Q&A.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With