Skip to main content

Bug Tracker

Side navigation

#8684 closed bug (invalid)

Opened March 28, 2011 06:26PM UTC

Closed March 30, 2011 04:17PM UTC

Last modified May 10, 2011 04:10PM UTC

Back button doesn't trigger $(window).load() in Firefox on jQuery >= 1.4

Reported by: st.dave@gmail.com Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.4
Keywords: Cc:
Blocked by: Blocking:
Description

Using a version of jQuery later than 1.3.2, the $(window).load() event isn't fired when you come to a page via the back button. It fires correctly on the inital page load, but subsequent visits via the browser history do not trigger the event.

The bug appears in Firefox 4.0 on Windows, Firefox 3.6.13 on Red Hat Linux, Safari 5.0.3 for Windows and Mac OS X, and Opera 11.01 on Windows. I cannot reproduce it in Internet Explorer 8.0 or Chrome 10.0.648.133 for Windows.

I have created a simple webpage that demonstrates the bug using various versions on jQuery from 1.2 - 1.5.

Reproducing

1. Open a webpage that has an event fire on $(window).load()

2. Click a link to navigate to another page.

3. Click the back button to return to the first page.

Observed Behavior: - The $(window).load() event does not fire when the original page is accessed via the back button.

Expected Behavior: - The $(window).load() event should fire when the page is accessed this way.

Attachments (0)
Change History (2)

Changed March 30, 2011 04:17PM UTC by john comment:1

resolution: → invalid
status: newclosed

More information about this can be found here:

https://developer.mozilla.org/en/using_firefox_1.5_caching#pageshow_event

If you wish to cause a page reload you can always just bind an event to window unload.

$(window).unload(function(){});

What's happening right now is the intended behavior of the browser.

Changed May 10, 2011 04:10PM UTC by the_dent2001@yahoo.com comment:2

Is there a cross-browser jQuery function for the desired behaviour?

Shouldn't $(window).load()'s behaviour be consistent cross-browser? document.ready behaves inconsistently too.