Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Iframe doesn't stop to loading

As answered in this post, I'm trying to set an Iframe's content with :

document.getElementById("iframe").contentDocument.write("Test123");

The problem is that even though everything seems to work (the Iframe is displaying Test123), the browser doesn't stop loading. Indeed, in Firefox's tab it's written "Connecting ..." with the spinner indicating it's still loading.

Why does it happen ? Is there a better solution to set an Iframe's content ?

like image 659
Jecimi Avatar asked Sep 17 '25 14:09

Jecimi


1 Answers

You need to close the iframe connection:

document.getElementById("iframe").contentDocument.close();

I think that this will work.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!