Closed Bug 418465 Opened 17 years ago Closed 17 years ago

onload event does not fire when using back button to return to a page.

Categories

(Firefox :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 312816

People

(Reporter: nod, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.12) Gecko/20080203 SUSE/2.0.0.12-0.1 Firefox/2.0.0.12 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.12) Gecko/20080203 SUSE/2.0.0.12-0.1 Firefox/2.0.0.12 If there is an onload event it does not fire when the user navigates back to the page after having been elsewhere, the page is at the state when the user left it. Reproducible: Always Steps to Reproduce: 1. put an onload event e.g. an alert 2. visit the page and trigger the event 3. go to another URL, hit the back button and the onload does not fire again. Actual Results: No onlaod fired when using the back button on 2.0.0.11 Linux, 2.0.0.11 Windows Wista, 2.0.0.12 Windows Vista & 2.0.0.12 Linux Expected Results: Onload should trigger when the page is loaded. Test code. Both do not function, either as a script or as an onload. <html> <head> <script language="javascript"> window.onload = function(){ alert('hello world'); } </script> </head> <body onload="alert('hello world');"> Go to any other URL and hit back button to get to this pae again, alert box does not come up ! </body> </html> <html> <head> </head> <body onload="alert('hello world');"> Go to any other URL and hit back button to get to this pae again, alert box does not come up ! </body> </html>
You should use the pagehide/pageshow event if you want your handlers to be fired on back/forward navigation. See http://developer.mozilla.org/en/docs/Using_Firefox_1.5_caching
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.