I\'m trying to get a pop-up to, well, pop up when there is no internet connection on the device.
I got the following example working, but now I want the alert only to sh
Try the below code.
var networkState = navigator.network.connection.type;
var states = {};
states[Connection.UNKNOWN] = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI] = 'WiFi connection';
states[Connection.CELL_2G] = 'Cell 2G connection';
states[Connection.CELL_3G] = 'Cell 3G connection';
states[Connection.CELL_4G] = 'Cell 4G connection';
states[Connection.NONE] = 'No network connection';
if ((states[networkState]) == states[Connection.NONE])
{
alert("Please check your internet connectivity and try again");
}