PhoneGap: Detect if running on desktop browser
I use this code: if (navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|IEMobile)/)) { document.addEventListener(“deviceready”, onDeviceReady, false); } else { onDeviceReady(); //this is the browser } UPDATE There are many other ways to detect if phonegap is running on a browser or not, here is another great option: var app = document.URL.indexOf( ‘http://’ ) === -1 && document.URL.indexOf( ‘https://’ ) === -1; … Read more