title: On Back button event Show confirm Yes,No option before closing app for window.open using Cordova InAppBrowser
body: <p>Well i'm newbie &amp; stuck at a point. And that might have simple solution as well..</p>
  
  <p>I load a page using <code>window.open</code> using InAppBrowser, While user press hardware backbutton I want to show confirm message before app gets close. I tried some code...
  Here is Code</p>
  
  <p><strong><code>index.html</code></strong></p>
  
  <pre><code>$(document).ready(function() {
      document.addEventListener("deviceready", onDeviceReady, false);
  
      function onDeviceReady() {
  
         var ref = window.open('http://stackoverflow.com/', '_blank', 'location=no,hardwareback=yes');
         ref.addEventListener('loadstart', function(event) { SpinnerPlugin.activityStart("Initializing..."); });
         ref.addEventListener('loadstop', function(event) { SpinnerPlugin.activityStop(); });
         ref.addEventListener('loaderror', function(event) { alert('error: ' + event.message); SpinnerPlugin.activityStop();});
         ref.addEventListener('exit', function(event) {
          alert('Exit')
          });
         ref.addEventListener("backbutton", function () { //But This is not triggering...Don't know why..
           onConfirm();
        })
         function onConfirm(button) {
              if (button == 1){ //Yes button pressed...
                  navigator.app.exitApp();
              } else{
                return false;
              }
          }
      }
  });
  </code></pre>
  
  <p>Even I tried <code>backbutton</code> event of Cordova..</p>
  
  <pre><code>document.addEventListener("backbutton", onBackKeyDown, false); //Listen to the User clicking on the back button
  function onBackKeyDown(e) {
      navigator.notification.confirm("Are you sure you want to exit ?", onConfirm, "Confirmation", "Yes,No");
  
  }
  </code></pre>
  
  <p>It gets triggered properly but after closing inner window..
  So again in brief, I want to show same confirm box before closing inner window.</p>
  
  <p><strong>Note:</strong> I'm using Cordova 6.1.0</p>
  
  <p>Thanks a-ton in-Advance</p>