Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
How to check internet connection without doing post back? I need to show a popup message if the connection to internet is not available. When its without going to error page no internet connection?
Posted
Updated 15-Jun-10 1:16am
v3

i found the solution
<script>
navigator.onLine()
</script>
 
Share this answer
 
There is no way to check the server is available until you send a request to it. One way to do is to send AJAX request and see the response status. You can put this in a JS timer which will get executed at specific interval. Depending on the response status, you can show the error message.
 
Share this answer
 
thanx all i found the solution :D
 
Share this answer
 
Sorry, but this does not make sense.

A webpage is processed on the server. In order to call a page a connection must exist and then any checking code on that page would be a bit pointless.

If your client (aka browser) has no connection, then it will not be able to call the webpage and again any checking for a connection on the webpage will be pointless. The browser itself will show an error anyway when a page cannot be reached.

Relocating to an error page on the server side is just as pointless. The error page is again provided by the webserver, which, lacking a connection, cannot be reached.
 
Share this answer
 
so how in Facebook when the internet connection not availabe it show u amessege, can u explaine please
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900