0

I wanted to know is it possible to check when the content in an iframe is loaded.

I have a hidden iframe and I don't want to show it until the webpage/website inside the iframe has loaded.

i tried the following, not really worked for me:

$('iframe').load(function() {
    ;
});

is that possible?

putvande
  • 15,068
  • 3
  • 34
  • 50
user1555190
  • 2,803
  • 8
  • 47
  • 80

1 Answers1

0

This cannot be done cross domain, only locally.

<iframe src="/amp" id="iframeID"></iframe>

document.getElementById("iframeID").contentWindow.onload = function(){
    alert('loaded');
};
gkiely
  • 2,987
  • 1
  • 23
  • 37