check if iframe is loaded jquery code example
Example 1: jquery when iframe is loaded
<script>
function checkIframeLoaded() {
var iframe = document.getElementById('i_frame');
var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
if ( iframeDoc.readyState == 'complete' ) {
iframe.contentWindow.onload = function(){
alert("I am loaded");
};
afterLoading();
return;
}
window.setTimeout(checkIframeLoaded, 100);
}
function afterLoading(){
alert("I am here");
}
</script>
<body onload="checkIframeLoaded();">
Example 2: jquery check if iframe is loaded
$('#myIframe').on('load', function(){
});