0
window.onbeforeunload = function (e) {
    e = e || window.event;

    // For IE and Firefox prior to version 4
    if (e) {
        e.returnValue = 'Any string';
    }

    // For Safari
    return 'Any string';
};

I tried this code for display the warning message when a user leaving / closing the tab / window in from the browser. This code is works in the chrome very well but in the Firefox will not work properly and even doesn't show the message also.

Please help me.

How to display the confirmation message on Firefox browser.

Thanks in advance.

ravi kumar
  • 107
  • 1
  • 1
  • 12
  • 1
    Possibly duplicate http://stackoverflow.com/questions/14645011/window-onbeforeunload-and-window-onunload-is-not-working-in-firefox-safari-o – brk Jun 18 '16 at 06:19
  • *«Since 25 May 2011, the HTML5 specification states that calls to window.alert(), window.confirm(), and window.prompt() methods may be ignored during this event. »* [Click here for this ref.](https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload) – Louys Patrice Bessette Jun 18 '16 at 06:23

0 Answers0