Detecting internet connection state using javascript
A lot of people over the net asks the same question :
How to find out if the Internet connection is connected or disconnected in ASP.NET?
But ASP.NET runs on the server, so if the user's Internet connection is disconnected,then the browser will not be able to connect to the web server to run ASP.NET code, that's why I thought this code should be client-side, so I digGed a little in java-script and here is an example of what I found out:
<script language="javascript">function CheckOnline()
{
if(navigator.onLine)
alert("You're online");
else
alert("You're offline");
}
</script>
<
body onload ="CheckOnline()">
</body>
I test it on Internet Explorer 7 and Mozilla and it worked well.