Reliable, fast and easy to use library to check your internet connection status
JavaScript HTML PHP
Latest commit 95714b8 Apr 14, 2015 @PixelsCommander Update


Lightweight and reliable library to check internet connection status.

Compatible browsers: IE 8-11, Opera, Chrome, Firefox, Android, iOS


Include this library into your project and just check is window.onLine === true.

Assign window.onLineHandler or window.offLineHandler functions to handle status changes.

Just look at example (index.html in the repo)!

You can change window.onLineURL to point OnlineJS to your own server.

More info in this blog post.


I`m often asked: “Why not just use navigator.onLine ?”. Using this property in critical tasks is bad idea. Property is underhandled and is not consistent among all browsers. It can show local connection status or react only on autonomous mode switching. Online JS is better way for serious project, it uses navigator.onLine and corresponding events as one of possible triggers and then makes more checks of internet connection.

Questions and propositions

Feel free to write me with any questions or propositions

Bug tracker

Have a bug? Please create an issue here on GitHub!

Twitter account

Keep up to date on announcements and more by following OnlineJS on Twitter, @pixelscommander.


Copyright 2011 Denis Radin.

Licensed under the Apache License, Version 2.0: