This site heavily relies on bug reports created by its readers. Anyone can report a bug and be published.
Main navigation:
Search reports by browser:
When you navigate with the Back and Forward buttons, Opera doesn't fire any load and unload events.
Test page. Workaround is not included.
Reported by ppk.
Opera | Reported on 26 November 2004.
Posted by Dante Evans on 26 November 2004
2Chris is absolutely right. Opera's speed and super-cool features are what makes me love it. This bug can be defeated by simply going to File: Preferences and unchecking "Cache documents"
Posted by ppk on 26 November 2004
3Unfortunately that turns out not to be the case. When I unchecked Preferences -> History and Cache -> Cache documents and did the test again the load and unload events still didn't fire when I used the Back and Forward buttons.
Posted by Tobias Michaelsen on 27 November 2004
5The page is indeed loaded. It is just loaded from the cache and is not fetched from the server.
The event should be fired when the document is loaded into the DOM.
Posted by Wout van der Klip on 27 November 2004
6Strange...when I use the back and forth buttons, the load event always fires. The unload event doesn't. (Opera 7.23)
Posted by Thomas Goyne on 28 November 2004
7The event is triggered when the page is loaded into the DOM. However, using back and forward does not cause the page to be reloaded in Opera as it does in other browsers. There is little difference between switching between pages in different windows/tabs and switching between pages in the same window/tab (with back/forward) in Opera, and surely you would agree onload/onunload shouldn't trigger when the user switches windows.
Posted by Thomas Goyne on 30 November 2004
8Why should there be a difference? I've tweaked my gestures a bit so that if I try to go forward or back and there isn't anything to go forward or back to, it switches to the next/previous page. As I generally have several times more pages open than will fit on the pagebar, often the only indication that I'm switching between open pages and not going back/forward is that the back button is greyed out (and I could fix that if I cared to).
I'm not sure what the specs constitutes loading, but I'm not sure how you could possibly call what Opera does on back/forward loading. The cached html isn't reparsed, forms stay filled out, and changes to the page made with javascript remain. If anything, triggering onload when the page isn't being loaded would be a bug.
Posted by TarquinWJ on 1 December 2004
9Correct. But for most pages, this does not matter, as Opera also remembers the runstate of any scripts that were running - so when you come back, the scripts continue running just like you never left. On virtually all sites, this means that there is no need for onload or onunload to fire. This only causes problems in framesets like this site - and personally, I am quite happy to live with it not highlighting the correct link in the navigation panel. This behaviour is a part of what makes opera so fast, and I wouldn't want it changed for anything.
Posted by ppk on 1 December 2004
10Sorry, but to me this all sounds suspiciously like fans of a browser explaining away bugs.
It's simple, really:
1. Load and unload should fire whenever a user enters or leaves a page
2. Opera doesn't fire them in all cases.
3. Therefore Opera has a bug.
4. All explanations about speed and such don't change this fact.
Posted by TarquinWJ on 1 December 2004
11absolutely it is fans explaining away bugs, because we don't consider them to be bugs. we want it to behave that way. I agree that web developers need to be aware of it, but they should also be aware that opera deals with it itself by also retaining script runstate
Posted by ppk on 1 December 2004
12Well, at least that's honest.
Let's agree to disagree, then.
Posted by Thomas Goyne on 2 December 2004
131. Load and unload should fire whenever a user enters or leaves a page
I actually disagree with that statement. If that was true, the events should be named onenter and onleave. From the DOM2 standard: "The load event occurs when the DOM implementation finishes loading all content within a document, all frames within a FRAMESET, or an OBJECT element." Opera does trigger onload when the page is loaded. However, back/forward does not cause the page to be reloaded, so onload is not triggered again. If something somewhere said that the back button should force the page to be reloaded not doing so would be a bug, but thankfully no spec says that.
It does appear that Opera is violating the spec in not triggering unload, as "The unload event occurs when the DOM implementation removes a document from a window or frame." Based on the differences in wording, I'd say its fairly clear that when the DOM events spec was written it had not occured to anyone that a browser wouldn't nessesarily reload a document whenever it is put into a window, which is odd, as Opera's behavior in this predates DOM2.
In short, it goes against what was probably intended, but doesn't actually go against what is written.
Posted by Mikko Rantalainen on 20 October 2005
14Firefox 1.5 will also include this feature. However, Firefox generates events "pageshow" and "pagehide" where "load" and "unload" would normally be generated. See http://developer.mozilla.org/en/docs/Using_Firefox_1.5_caching for more details.
Commenting guidelines:
Posted by Chris Hester on 26 November 2004
1This is because Opera fetches previous pages from its cache. So nothing is reloaded. This is what makes it super fast.