Firefox This page is asking you to confirm that you want to leave

I have a script that if user is uploading file and try to close the browser it will trigger the onbeforeunload() and popup an alert.. I change the message but somehow it does not work in firefox, it works perfectly fine on IE or opera or safari.. the code is something like

window.onbeforeunload = checkUnload;
function checkUnload() {

if (document.upload.isEmailing())
    return "Aaaa";

So, in IE and opera, when users close the browser during emailing, it will show pop up saying “AAAA” with leave or stay page button.

  • Whitelisting inline script with csp sha-256 in firefox
  • How to assign builtin methods on console and document to variables in javascript?
  • Copy to clipboard on firefox and google chrome
  • How to fire mouse wheel event in Firefox with JavaScript?
  • Firefox not starting onreadystatechange function
  • Detecting composed characters to ignore some of them
  • However, in firefox, it show

    “This page is asking you to confirm that you want to leave – data you have entered may not be saved.” with leave or stay page button.

    Why it does not work, am I doing something wrong?

    Note: FF I am using is the latest version if that will help.

  • javascript 'let' and 'var' in for-loops
  • Firefox blocking Facebook Js
  • Firefox printing PDF in an iframe throws an error
  • Animated gifs not restarting in Firefox (with examples)
  • Firefox and RequireJS still pulling from cache even with toolbox open
  • How to communicate a simple html page containing a button with an add-on script using port.emit
  • 2 Solutions collect form web for “Firefox This page is asking you to confirm that you want to leave”

    For security reasons, Firefox now ignores the string you return.
    There is nothing you can do about it.

    According to MDN:

    Note that in Firefox 4 and later the returned string is not displayed
    to the user.

    See the referenced bug for more info.