Back to Demos List

GSW Browser: Network


This page displays the current network type.






About This Demo

This demo is using the cordova-plugin-network-information plugin. For more information click here:


var GSW = GSW || {};
GSW.Tests = GSW.Tests || {};

GSW.Tests.onDeviceReady = function() {
	// Cordova is now initialized. Have fun!
	console.log('Now running cordova-' + cordova.platformId + '@' + cordova.version);
	GSW.Tests.displayNetwork = function() {
		var cont = document.getElementById('network');
		let status = navigator.connection.type;
		cont.innerHTML = "Current Network Type: "+ navigator.connection.type.toUpperCase();
	}
	document.getElementById("display").addEventListener("click", GSW.Tests.displayNetwork);
}
document.addEventListener('deviceready', GSW.Tests.onDeviceReady, false);