I have a form that redirects to a site if its online or print error message if its online.
Now I want to delay and redirect to the site whether offline or online after 5 seconds elapse.
I have added setTimeout() but it does not delay for 5 minutes before redirecting to another site.
Any help
Code:
<script type="text/javascript">
//start checking onlineconnection status
function checkconnection() {
var status = navigator.onLine;
if (status) {
window.onload=timeout;
function timeout(){
window.setTimeout("redirect()",5000)}
window.location="www.online.com"
} else {
window.location="www.offline.com"
}
}
</script>
on the body, i have onload() event
Code:
<body onload="checkconnection();">
Any Help
Bookmarks