Hello, I was wondering if I can have a timer, or delay before my IFrame Loads? The IFrame code I am using is below <iframe src="mysite.com" width="100%" height="1300" scrolling="no" frameborder="0" id="myframe" style="background-color: #ffffff;" allowtransparency="true" border="0"></iframe> Code (markup): I need something that will work with the current coding I have for color, size, width, and so on. Thanks for any help.
There are various ways to do it: Method 1 <iframe src="http://website.com/iframe1.htm"></iframe> Code (markup): <meta http-equiv="refresh" content="10;url=http://website.com/iframe2.htm" /> Code (iframe1.htm): Method 2 - have a javascript with delay followed by document.write(the iframe code); Method 3 - use PHP sleep(); to delay the iframe execution etc.
I came up with a fix which is basically the same thing using JavaScript but I have CSS with it as well for formatting. I will paste the code below in case anyone else has this question. You can add or delete options in the CSS part to customize it more. "setTimeout(loadfunction,10000)" is telling the browser to delay loading the IFrame for ten seconds. //JavaScript// <script type="text/javascript"> window.onload = function() { setTimeout(loadfunction,10000) } function loadfunction() { document.getElementById("myiframe").src = "http://www.google.com" } </script> HTML: //CSS// <style type="text/css"> <!-- #myiframe { height: 600px; width: 100%; border: 0; background-color: #000; } --> </style> HTML: //IFrame// <iframe id="myiframe"></iframe> HTML: