I'm using the 'heyoffline' script (https://github.com/oskarkrawczyk/heyoffline.js) to determine whether users have an active internet connection, and if not, show a notification.
What I want to do is onload, check if they are online, and if so, redirect to another page, but if offline, load as normal. I'm not sure how to code this.
I want to accomplish this:
If onOnline = true, then redirect, otherwise just load page as normal.
Any help would be great.
That's an interesting script.
I've just been having a look at the code and it seems to use
navigator.onLine to detect if one is online or not.
window.location = "http://www.sitepoint.com";
Please be aware, that this doesn't seem to be reliable 100% of the time, as is discussed here: http://news.ycombinator.com/item?id=4818380
This topic is now closed. New replies are no longer allowed.