For both Firefox and Chrome, I am trying to override the default message that is displayed by the browser for onbeforeOnLoad function. Below are the issues i found
- I was not able to override the message even though i tried my heart out.
- I am not at all able to capture the event on Stay Page or Leave Page. I want to perform actions like if it is Stay Page Do This and if it is Leave Page do This.It is not even displaying the alert message for the event.
Please find the code i have been trying:
window.onbeforeunload = function(e)
{
alert(e);
var myMessage = 'Hello.';
e.returnValue = myMessage;
return dialogText;
};
Tried this as well:
window.onbeforeunload = function() {
return 'Hello!';
}