We help IT Professionals succeed at work.
Get Started

Javascript code to detect loss of internet connectivity

NeoGemini asked
Last Modified: 2010-08-05
I am writing a web based chat service much like the one here:

My question is this, if you look at that example, it uses a hidden iFrame that auto-refreshes itself then writes any new chat lines it pulls to the main menu, which works great, until the client looses their internet connection. Then the auto-refreshing iFrame turns into a page cannot be displayed error, and no further lines in the chat are displayed since that page is no-longer auto-refreshing. My question becomes what would be the best way to detect that the frame is no longer refreshing and force a reload every 5-10 seconds until the connection resumes itself, then of course the iFrame's own refresh would take over? This has to assume a complete loss of internet connectivity, so I would assume it would be a bit of javascript in the main page that does not auto-refresh, so it would continue to work even if a loss of connectivity is experienced.

Any help in the right direction would be appreciated, thank you!
Watch Question
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE