Check online/offline

Hi,
How can I check using javascript that I'm working online/offline(I'm using IE).
When the user clicks on a button and he has clicked/selected (Files--->WorkOffline),then,I should display an alert box like "Can't perform operations when you are offline".
Any ideas/suggestions will be greatly helpful for me.Thanks in advance.
tmmetAsked:
Who is Participating?
 
Michel PlungjanConnect With a Mentor IT ExpertCommented:
if ( navigator.onLine )

Michel
0
 
Michel PlungjanIT ExpertCommented:
so

<input type="button" onClick="if ( document.all && !navigator.onLine ) alert('Sorry, can\'t perform operations when you are offline'); else doWhatever()">

Michel

0
 
tmmetAuthor Commented:
Hi,
Thanks for your immediate reply...
I would be glad if you help me out...
Whatever alert message I'm giving,is getting displayed...
After my alert message,
I want the browser message to get displayed...That is,message box to connect /to stay offline...
How to trap the browser message...
Any ideas/suggestions will be greatly helpful for me...
Thanks in advance.
0
 
Michel PlungjanIT ExpertCommented:
See your other post...

Michel
0
All Courses

From novice to tech pro — start learning today.