Forum Moderators: open
I have a iframe page which calls an external website to get code. Im a little worried if that site goes down for a period of time and my page wont load correctly.
Is it possible to set a timeout period for that iframe to say in 10 seconds and if the page is not loaded, a local html page loads in that Iframe saying temp unavailable?
Thanks
Steve
What I want is that if the host content is not loaded in a period of time say 5 secs I want to load a local page instead in my iframe saying temp not available.
If I cant do this is there a way to download my dhtml nav menu before the iframe external content?
Thanks
Steve
function sorry() {
window.location="path/to/apology.html";
}
var kill = window.setTimeout("sorry()", 10000);
<body onLoad="window.clearTimeout(kill);">
...I've used similar to deal with images that don't load (with onLoad placed in the image tag).
Good luck!
<script language="JavaScript">
<!--
in here
//-->
</script>
... and the other line is of course the <body> tag of your document.
Theory is if the page doesn't load in 10 secs (10000 microseconds) the sorry() function will run and forward the visitor to an "apology" page. If the page does load the timer will be shut off (clearTimeout(kill)) and all's well.
I hope. ;)