This article describes the method of implementing delayed loading of iframe framework in JavaScript. Share it for your reference. The specific implementation method is as follows:
Sometimes we hope that some things on the page can be loaded in a delayed manner, so that they can not affect the website opening speed. Let me introduce to you the method of implementing the iframe framework delayed loading in JavaScript.
Requires loading of the region HTML code:
Copy the code as follows:<div id="indexlogin"></div>
The following code is placed at the bottom
Copy the code as follows:<span id="tmpjsnews"><script type="text/javascript" src="js you called" language="javascript"></script></span>
<script type="text/javascript">document.getElementById("indexlogin").innerHTML=document.getElementById("tmpjsnews").innerHTML;</script>
Code Two
Copy the code as follows: window.onload = function() {
frames["BiframeName"].location.href = "B.htm";
}
Use setTimeout
The code copy is as follows: setTimeout(function(){
var frame = document.createElement('IFAME');
frame.src = ' http://xxx.com';
document.getElementById('container').appendChild(frame);
}, 60000);
I hope that the description in this article will be helpful to everyone's web programming based on javascript.