I am new to phonegap. I have prepared one sample application. My application has 2 pages, the first page has one button, when clicked the second page will open. It is workin
I used a combination of the above because my app works in the browser as well as on device. The problem with browser is it won't let you close the window from a script unless your app was opened by a script (like browsersync).
if (typeof cordova !== 'undefined') {
if (navigator.app) {
navigator.app.exitApp();
}
else if (navigator.device) {
navigator.device.exitApp();
}
} else {
window.close();
$timeout(function () {
self.showCloseMessage = true; //since the browser can't be closed (otherwise this line would never run), ask the user to close the window
});
}