Bug Tracker

Modify

Ticket #8684 (closed bug: invalid)

Opened 2 years ago

Last modified 15 months ago

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

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

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.

Change History

comment:1 Changed 2 years ago by john

  • Status changed from new to closed
  • Resolution set to invalid

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.

comment:2 Changed 2 years ago by the_dent2001@…

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.