title: AngularJS window.onbeforeunload is not working on Android and Iphone
body: <p>I am using the following code:-</p>
  
  <pre><code> .directive('confirmOnExitForm', function() {
          return {
              link: function($scope, elem, attrs) {
                  window.onbeforeunload = function(){
                      if ($scope.form.$dirty) {
                          return "The form is dirty, do you want to stay on the page?";
                      }
                  }
  
              }
          };
      })
  </code></pre>
  
  <p>This code is working fine on Desktops Chrome and Safari, but it is not working for Android and Iphones.</p>
  
  <p>Any idea why?</p>