Click to See Complete Forum and Search --> : Detection internet connection with javascript
vinsa
08-24-2003, 03:29 AM
Hello,
I need for javascript for my webpage.
I use my page on my local computer
and want when onload the page, the
script to give me massage whether I have
internet connection or I havn't. Is this possible with
javascript?
navigator.onLine (boolean) only supported by IE
vinsa
08-26-2003, 08:14 AM
Thank you fang but how can I use this - navigator.onLine(boolean). I try this but it not work:
<html>
<head>
<title>check</title>
<meta content="text/html; charset=windows-1251" http-equiv=Content-Type>
<script type="text/javascript">
<!--
function check() {
if (navigator.onLine(boolean)) {
alert("you are online")
}
else {
alert("you are not online")
}
}
//-->
</script>
</head>
<body onload="check()" >
</body>
</html>
vinsa
08-26-2003, 08:20 AM
Thank you fang but how can I use this - navigator.onLine(boolean). I try this but it not work:
<html>
<head>
<title>check</title>
<meta content="text/html; charset=windows-1251" http-equiv=Content-Type>
<script type="text/javascript">
<!--
function check() {
if (navigator.onLine(boolean)) {
alert("you are online")
}
else {
alert("you are not online")
}
}
//-->
</script>
</head>
<body onload="check()" >
</body>
</html>