I am using the following 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?";
}
}
}
};
})
This code is working fine on Desktops Chrome and Safari, but it is not working for Android and Iphones.
Any idea why?