Cordova Check for network connection and notify

Checks for the presence of an internet connection, notifies user if no connection is available.
// check network status, if no connection, alert
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
	var networkState =;
	if(networkState === Connection.NONE) {
function noConnectionNotify() {
		'Could not connect to server. Please check your internet connection.',
		function() { 
			// do something after user clicks okay
Posted by
Snippet Viewed 3826 times.

Share your Cordova code snippets:

  • Get some recognition & link back to your site.


Submit | Browse

Most Recent cordova snippets

Most Viewed