el ninho
el ninho

Reputation: 4233

Determine if connection is dead on clientside

I have a site which have a div in updatepanel, which is refreshed every 10 seconds, and I pass string result to div. If connection is dead, i get error that server is unavailable, which should not happen.

My question is, how to check clientside if connection is down, so I can just pass empty string to that div, and that page remains.

Thanks.

Upvotes: 0

Views: 149

Answers (1)

jbkkd
jbkkd

Reputation: 1550

See this:

Check if Internet Connection Exists with Javascript?

If you need an immediate solution, you could use this:

var online = navigator.onLine;

Upvotes: 1

Related Questions