connection - How can I define if my pc has access to internet with javascript? -
i developing chrome extension application, , using javascript check if users connected network.
var statuselem = document.getelementbyid('status');
var intervalid = setinterval(function () { if (navigator.online) { // clear interval clearinterval(intervalid); // you're online. redirect desired url window.location = "popup.html"; } else { statuselem.classname = 'offline'; statuselem.innerhtml = '<span style="color: red">connect device internet</span>'; } }, 500); but doesen't check if network connection has access internet, there anyway check if sending or receiving data internet?
if it's fine use library, can take @ - http://github.hubspot.com/offline.
Comments
Post a Comment