Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. function callAnothePage()
  2. {
  3. window.location = "test.html";
  4. }
  5.  
  6. function exitFromApp()
  7. {
  8. navigator.app.exitApp();
  9. }
  10.  
  11. <!DOCTYPE html>
  12. <html>
  13.  
  14. <head>
  15. <script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script>
  16. <script type="text/javascript" charset="utf-8">
  17. function onLoad()
  18. {
  19. console.log("device reday !!!!")
  20. document.addEventListener("deviceready", onDeviceReady, true);
  21. }
  22. function exitFromApp()
  23. {
  24. console.log("in button");
  25. navigator.app.exitApp();
  26. }
  27. </script>
  28. </head>
  29.  
  30. <body onload="onLoad();">
  31. <h4><center>Login Page</center></h4>
  32.  
  33. <input type="submit" onclick="exitFromApp()" value="exit"/>
  34.  
  35. </body>
  36. </html>
  37.  
  38. <!DOCTYPE HTML>
  39. <html>
  40. <head>
  41. <title>PhoneGap</title>
  42.  
  43. <script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"></script>
  44. <script type="text/javascript" charset="utf-8">
  45.  
  46. function onLoad()
  47. {
  48. document.addEventListener("deviceready", onDeviceReady, true);
  49. }
  50.  
  51. function exitFromApp()
  52. {
  53. navigator.app.exitApp();
  54. }
  55.  
  56. </script>
  57.  
  58. </head>
  59.  
  60. <body onload="onLoad();">
  61. <button name="buttonClick" onclick="exitFromApp()">Click Me!</button>
  62. </body>
  63. </html>
  64.  
  65. if (navigator.app) {
  66. navigator.app.exitApp();
  67. } else if (navigator.device) {
  68. navigator.device.exitApp();
  69. } else {
  70. window.close();
  71. }
  72.  
  73. navigator.app.exitApp();
  74.  
  75. exitApp:function() {
  76. console.log("Device.exitApp() is deprecated. Use App.exitApp().");
  77. app.exitApp();
  78. }
  79.  
  80. if(navigator.app){
  81. navigator.app.exitApp();
  82. }else if(navigator.device){
  83. navigator.device.exitApp();
  84. }
  85.  
  86. if (navigator.app) {
  87. navigator.app.exitApp();
  88. }
  89. else if (navigator.device) {
  90. navigator.device.exitApp();
  91. }
  92. else {
  93. window.close();
  94. }
  95.  
  96. if (typeof cordova !== 'undefined') {
  97. if (navigator.app) {
  98. navigator.app.exitApp();
  99. }
  100. else if (navigator.device) {
  101. navigator.device.exitApp();
  102. }
  103. } else {
  104. window.close();
  105. $timeout(function () {
  106. self.showCloseMessage = true; //since the browser can't be closed (otherwise this line would never run), ask the user to close the window
  107. });
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement