Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function callAnothePage()
- {
- window.location = "test.html";
- }
- function exitFromApp()
- {
- navigator.app.exitApp();
- }
- <!DOCTYPE html>
- <html>
- <head>
- <script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script>
- <script type="text/javascript" charset="utf-8">
- function onLoad()
- {
- console.log("device reday !!!!")
- document.addEventListener("deviceready", onDeviceReady, true);
- }
- function exitFromApp()
- {
- console.log("in button");
- navigator.app.exitApp();
- }
- </script>
- </head>
- <body onload="onLoad();">
- <h4><center>Login Page</center></h4>
- <input type="submit" onclick="exitFromApp()" value="exit"/>
- </body>
- </html>
- <!DOCTYPE HTML>
- <html>
- <head>
- <title>PhoneGap</title>
- <script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"></script>
- <script type="text/javascript" charset="utf-8">
- function onLoad()
- {
- document.addEventListener("deviceready", onDeviceReady, true);
- }
- function exitFromApp()
- {
- navigator.app.exitApp();
- }
- </script>
- </head>
- <body onload="onLoad();">
- <button name="buttonClick" onclick="exitFromApp()">Click Me!</button>
- </body>
- </html>
- if (navigator.app) {
- navigator.app.exitApp();
- } else if (navigator.device) {
- navigator.device.exitApp();
- } else {
- window.close();
- }
- navigator.app.exitApp();
- exitApp:function() {
- console.log("Device.exitApp() is deprecated. Use App.exitApp().");
- app.exitApp();
- }
- if(navigator.app){
- navigator.app.exitApp();
- }else if(navigator.device){
- navigator.device.exitApp();
- }
- if (navigator.app) {
- navigator.app.exitApp();
- }
- else if (navigator.device) {
- navigator.device.exitApp();
- }
- else {
- window.close();
- }
- 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
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement