-1

I am Beginer for intel xdk , i have made an app for android device, in app. i have set a button as a back button , my app have 6 pages, one of them is an index page which is load first and then navigate too the another page , when i am on index page , press a back button which inbuilt in device it redirect me on the page according to history instead of exit the app.. it behaves just like a web browser back button, because my code is in html5 format.

i want to use this button to quit from this application how can I use it or code...*/

   <script>
window.history.forward();
             function noBack() { 
                  window.history.forward(); 
             }


</script>
<body onload="noBack();" onpageshow="if (event.persisted) noBack();">
Hardik Vyas
  • 500
  • 1
  • 7
  • 27
  • Have you built your app as a hybrid application? There are JavaScript API commands for managing the hardware back button on an Android device. Have you looked over those? – profMobi Dec 18 '13 at 20:57

1 Answers1

0

You can use the navigator.app.exitApp() function from the Cordova API if you include the cordova.js library (after the intelxdk.js library). But it only works on Android devices, it is not supported anywhere else.

You would execute this code when you capture the Android hardware back button.

xmnboy
  • 2,314
  • 2
  • 14
  • 31