<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Backbutton</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /> <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script> <script type="text/javascript" src="../cordova.js"></script> <script> document.addEventListener("deviceready", onDeviceReady, false); // Without backbutton handler, each tab loaded will be popped off history until history is empty, then it will exit app. function handleBackButton() { alert("Back Button Pressed! - exiting app"); navigator.app.exitApp(); } function onDeviceReady() { console.log("onDeviceReady()"); document.addEventListener("backbutton", handleBackButton, false); } </script> </head> <body> <div data-role="page" id="tabTab"> <div data-role="header"> <h1>Main</h1> </div> <div data-role="content" id="tabContent"> To test, press several tabs.<br> The "backbutton" can be pressed any time to exit app. </div> <div data-role="footer" data-position="fixed"> <div data-role="navbar"> <ul> <li><a href="tab1.html" data-transition="none">Tab 1</a> </li> <li><a href="tab2.html" data-transition="none">Tab 2</a> </li> <li><a href="tab3.html" data-transition="none">Tab 3</a> </li> </ul> </div> </div> </div>