Mozilla サポートの検索

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.

詳しく学ぶ

このスレッドはアーカイブに保管されました。 必要であれば新たに質問してください。

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; });

すべての返信 (1)

more options

Could you try the code pattern in this article:

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