Javascript: Is my browser on line?

if (navigator.onLine){ alert('You r connected!'); } else { alert('No connection :('); }
single way to know if our browser is on line (internet connection). This top was taken from blogs. Non tested for all browsers. I will test it when I can but I was interested on this.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.