This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Lolu chungechunge lwabekwa kunqolobane. Uyacelwa ubuze umbuzo omusha uma udinga usizo.

I need to pop up an alert while closing my application in firefox and I am using the latest version of fire fox. I used unload,onbeforeunload But nothing works

more options

I have used the following code:

       var myEvent = window.attachEvent || window.addEventListener;
       var chkevent = window.attachEvent ? 'onbeforeunload' : 'beforeunload'; /// make IE7, IE8 compitable
       myEvent(chkevent, function(e) { // For >=IE7, Chrome, Firefox
           var confirmationMessage = 'Are you sure to leave the page?';  // a space
           (e || window.event).returnValue = confirmationMessage;
           return confirmationMessage;
       });
I have used the following code: var myEvent = window.attachEvent || window.addEventListener; var chkevent = window.attachEvent ? 'onbeforeunload' : 'beforeunload'; /// make IE7, IE8 compitable myEvent(chkevent, function(e) { // For >=IE7, Chrome, Firefox var confirmationMessage = 'Are you sure to leave the page?'; // a space (e || window.event).returnValue = confirmationMessage; return confirmationMessage; });

All Replies (1)

more options

Could you try the code pattern in this article:

https://developer.mozilla.org/docs/Web/Events/beforeunload