<script src="cordova-1.9.0.js"></script>
<script> function onLoad() { document.addEventListener("deviceready", onDeviceReady, true); } </script>
<body onload="onLoad">
function showConfirm() { navigator.notification.confirm( 'Yakin ingin keluar ?', exitFromApp, 'Exit', 'Cancel,OK' ); } function exitFromApp(buttonIndex) { if (buttonIndex==2){ navigator.app.exitApp(); } }
<button onclick="showConfirm()">
<html > <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="cordova-1.9.0.js"></script> </head> <script type="text/javascript"> function onLoad() { document.addEventListener("deviceready", onDeviceReady, true); } function showConfirm() { navigator.notification.confirm( 'Yakin ingin keluar ?', exitFromApp, 'Exit', 'Cancel,OK' ); } function exitFromApp(buttonIndex) { if (buttonIndex==2){ navigator.app.exitApp(); } } </script> <body onload="onload()"> <button onclick="showConfirm()"> </body> </html>
© SD Shared 2013 . Powered by Bootstrap Blogger Templates
mas apakah fungsi dari navigator.app.exitApp(); bisa di rubah ke fungsi yang lain? jadi maksud saya ketika saya menekan tombol kembali maka otomatis ke homescreen android? mohon pencerahannya terimkasih
ReplyDelete