title: prompt user on backspace and browser backbutton in gwt
body: <p>I have two classes when navigating from one class to another created history. Now, I want to prompt the user by a confirm whether user wants to leave the page or not.Till now , I tried using <code>Window.closingHandler()</code> in <code>gwt</code> but its not working for backspace button and browser back button its only working on closing the entire browser or that particular page using cross. Its also working on reload.</p>
  
  <p>I have also tried on Javascript and it worked perfect using <code>onbeforeunload()</code>.</p>
  
  <p>Here are the codes I used.</p>
  
  <p>JAVASCRIPT:</p>
  
  <pre><code>window.onbeforeunload = function () {
    return "Are you sure you wish to leave this delightful page?";
  }
  </code></pre>
  
  <p>And the other code in gwt:</p>
  
  <pre><code>Window.addWindowClosingHandler(new Window.ClosingHandler() {
      public void onWindowClosing(ClosingEvent event) {
          event.setMessage("Do you wanna close?");
          System.out.println("Closing...");
      }
  });
  </code></pre>
  
  <p>I want it to be done in <code>gwt</code>.</p>