title: How to prevent Android from closing web-application when backbutton is pressed?
body: <p>I am developing a HTML5 web-application and compiling it with Cordova (phonegap) 1.7. </p>
  
  <p>I want to override the Android backbutton so that I can call window.history.back() instead of closing the application (default Android). How can I prevent Android from killing the defaultactivity on back button pressed?</p>
  
  <p>I get the "Back button pressed!!!!" in logcat, so the method is fired before the application is closed. </p>
  
  <p>This is what I have so far: </p>
  
  <pre><code>        // Wait for Cordova to load
          //
          document.addEventListener("deviceready", onDeviceReady, false);
  
          // Cordova is ready
          //
          function onDeviceReady() {
  
              document.addEventListener("backbutton", function(e) {
  
                  console.log("Back button pressed!!!!");                 
                  window.history.back();
  
  
              }, false);
  
          }
  </code></pre>
  
  <p>EDIT: I am willing to accept an answer explaining a way to simulate the window.history.back() directly from the DefaultActivity.java android class if that is possible!</p>