Reputation: 4288
I need to detect internet connection in my js file. i used Navigator.Online but it is not reliable especially in the Firefox and Safari.
Only chrome seems to return right output. I also came across wonderful jquery plugin checkNet but after analyzing it, i found it is only checking for server not for internet because when i run it in local it checks it from xammp server
this are the links which i used for reference
http://tomriley.net/blog/archives/111
Check if Internet Connection Exists with Javascript?
Jquery Plugin for Detecting Internet Connection
Is there other easy way to check internet connection using jquery/Java script in all browsers. I need to check the internet connection not the server error and i am also dealing with cross domain i.e. data is passed between two different domains/servers
here is navigator online code which i used but it does not seems to work perfectly
var netCheck = navigator.onLine ? 'online' : 'offline';
any thing jquery, javascript or PHP solution will work
Upvotes: 0
Views: 323