I have implemented the suggestion from
window.onbeforeunload and window.onunload is not working in Firefox , Safari , Opera?
but it still does not work
var myEvent = window.attachEvent || window.addEventListener;
var chkevent = window.attachEvent ? 'onbeforeunload' : 'beforeunload';
myEvent(chkevent, function (e) {
var confirmationMessage = 'Are you sure to leave the page?';
(e || window.event).returnValue = confirmationMessage;
return confirmationMessage;
});
I have tried this but it is not working in mozilla. it works for once only. please help me to solve this.
I have solved this from testing process. there was lacking of user interaction in firefox. If user interact with page after that user confirm message appear.