1<script>
2function checkIframeLoaded() {
3 // Get a handle to the iframe element
4 var iframe = document.getElementById('i_frame');
5 var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
6
7 // Check if loading is complete
8 if ( iframeDoc.readyState == 'complete' ) {
9 //iframe.contentWindow.alert("Hello");
10 iframe.contentWindow.onload = function(){
11 alert("I am loaded");
12 };
13 // The loading is complete, call the function we want executed once the iframe is loaded
14 afterLoading();
15 return;
16 }
17
18 // If we are here, it is not loaded. Set things up so we check the status again in 100 milliseconds
19 window.setTimeout(checkIframeLoaded, 100);
20}
21
22function afterLoading(){
23 alert("I am here");
24}
25</script>
26
27<body onload="checkIframeLoaded();">
1$('#myIframe').on('load', function(){
2 //your code (will be called once iframe is done loading)
3});