This article describes the method of JS to determine whether an iframe is loaded. Share it for your reference, as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title></title></head><body><script type="text/javascript">var isIE = /msie/i.test(navigator.userAgent) && !window.opera;var iframe = document.createElement("iframe");iframe.src = "//www.VeVB.COM/";if (isIE) { iframe.onreadystatechange = function(){ if(iframe.readyState == "loaded" || iframe.readyState == "complete"){ alert("loaded"); } };} else { iframe.onload = function(){ alert("loaded"); };} document.body.appendChild(iframe);</script></body></html>or:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title></title></head><body><script type="text/javascript">var iframe = document.createElement("iframe");iframe.src = "//www.VeVB.COM/";if (iframe.attachEvent){ iframe.attachEvent("onload", function(){ alert("loaded"); });} else { iframe.onload = function(){ alert("loaded"); };}document.body.appendChild(iframe);</script></body></html>For more information about JavaScript related content, please check out the topics of this site: "Summary of JavaScript Operation Iframe Skills", "Summary of JavaScript Search Algorithm Skills", "Summary of JavaScript Data Structure and Algorithm Skills", "Summary of JavaScript traversal algorithms and techniques", "Summary of json operation techniques in JavaScript", "Summary of JavaScript Switching Special Effects and Skills", "Summary of JavaScript Animation Special Effects and Skills", "Summary of JavaScript Errors and Debugging Skills" and "Summary of JavaScript Mathematical Operation Usage"
I hope this article will be helpful to everyone's JavaScript programming.