window.onbeforeunload doesn't work in FF 3.5

RESOLVED WORKSFORME

Status

()

RESOLVED WORKSFORME
9 years ago
8 years ago

People

(Reporter: heythere119, Unassigned)

Tracking

3.5 Branch
x86
All
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5

window.onbeforeunload does not execute when the browser window is closed. I am using the following javascript to set the onbeforenload action:

window.onbeforeunload = function (e) {

  var e = e || window.event;

  // For IE and Firefox
  if (e) {
    e.returnValue = 'Message here';
  }
  // For Safari
  return 'Message here';
};

This code worked in FF 3.0 but no longer works in FF 3.5. The window does not prompt the user for confirmation on closing the window. The function never executes.

Reproducible: Always

Steps to Reproduce:
Closing the browser window after setting window.onbeforeunload.
Actual Results:  
Window closes without prompting user for confirmation on closing browser.

Expected Results:  
User is prompted for confirmation in closing the window.

This feature worked in FF 3.0 but no longer works in 3.5.
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.1pre) Gecko/20090711 Shiretoko/3.5.1pre

This works fine for me. Maybe an add-on is causing problems? Please try safe-mode to find out: http://support.mozilla.com/en-US/kb/Safe+Mode
Version: unspecified → 3.5 Branch
WFM on Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5
(Reporter)

Comment 3

9 years ago
I just noticed that this only occurs when using tabs. If I close the tab it will not prompt for confirmation, but if I try to 'x' out of Firefox completely, the confirmation is displayed.

Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5
(Reporter)

Updated

9 years ago
OS: Windows Server 2003 → All

Comment 4

8 years ago
WFM
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.11pre) 
Gecko/20100920 Namoroka/3.6.11pre

Mozilla/5.0 (Windows NT 6.0; rv:2.0b7pre) 
Gecko/20100918 Firefox/4.0b7pre

Please test this by disabling extensions one by one.
Let us know if it still appear after disabling all the addons
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.