Skip to main content

Bug Tracker

Side navigation

#12547 closed bug (notabug)

Opened September 17, 2012 10:32AM UTC

Closed September 20, 2012 02:26PM UTC

window.onbeforeunload fires twice with IE8 under special circumstances

Reported by: christoph.strasser@ooe.gv.at Owned by: christoph.strasser@ooe.gv.at
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.1
Keywords: Cc:
Blocked by: Blocking:
Description

The event window.onbeforeunload fires twice when we click a button via Javascript.

Problem-reproduction:

http://194.48.48.79/jQueryBugs/ZZZ_jQueryOnBeforeUnloadFiresTwice_IE8.html

It happens, when clicking "click button via JavaScript" or "click dynamic generated button".

The problem occurs with IE8, it does not occure with Firefox (15) and Chrome (21).

It worked fine up to jQuery 1.6.4, since jQuery 1.7 (tested up to 1.8.1) it is broken.

Attachments (0)
Change History (5)

Changed September 19, 2012 12:37PM UTC by dmethvin comment:1

owner: → christoph.strasser@ooe.gv.at
status: newpending

I believe this is because of the use of inline handlers. Can you create a test case that does not use them for comparison? In oldIE there are situations where inline handlers are executed twice, and we're unable to fix that.

Changed September 20, 2012 05:50AM UTC by christoph.strasser@ooe.gv.at comment:2

status: pendingnew

Added two additional test cases to the existing sample. It does not matter whether you use inline handlers or not. I´m able to work around the problem by clicking the other button without jquery (=only using "classic" javascript).

The problem exists also with IE9. I made all my tests with Windows 7.

Changed September 20, 2012 06:23AM UTC by christoph.strasser@ooe.gv.at comment:3

Made a mistake within the extended sample. My last comment was wrong, will provide an update...

Changed September 20, 2012 07:30AM UTC by christoph.strasser@ooe.gv.at comment:4

Changed September 20, 2012 02:26PM UTC by dmethvin comment:5

resolution: → notabug
status: newclosed

If you get a chance, can you post here with a summary of the problem and your workaround? It may be useful if someone else encounters it.