var frame_loaded = 0;
function setFrameLoaded() {
frame_loaded = 1;
}
$('#btn').click(function() {
if (frame_loaded == 1) {
console.log('iframe loaded');
} else {
console.log('iframe not loaded');
}
})
<button id="btn">click me</button>
<iframe onload="setFrameLoaded();" src='http://www.load41.com'/></iframe>
Hello, I need help. How can I detect if an iframe has finished loading in my website? I read that I could use onerror
but I don't know how. Thanks!