473,386 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,386 developers and data experts.

Browser Quirk: onload/onunload do not fire on back/forward/refresh (Opera)

acoder
16,027 Expert Mod 8TB
Problem
onload and onunload events do not fire when going back, forward or refreshing the page

Browser
Opera

Example
Any code using onload or onunload, e.g.
Expand|Select|Wrap|Line Numbers
  1. window.onload = init;
where init() is a function which initialises some variables (for example).

Solution
There is no solution because according to Opera developers and users this is not a bug. Opera maintains the runstate of scripts, so it's as if we never left the page when we return back to it. According to Opera, onload should only fire when loading the page for the first time and onunload should fire when unloading the page completely, not when just leaving the page by pressing the back, forward or refresh button. Refresh is considered to be a reload, not an unload.

This should be something you should be mindful of when depending on onload and onunload in your code.

Obviously, if onunload does not fire, onbeforeunload (which is a non-standard event supported by some browsers) will not work either.

More Bugs, Quirks and Inconsistencies
Aug 18 '07 #1
0 11789

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: pmelanso | last post by:
hello, I want to create back and forward buttons on my web page. I didn't have a problem with that... the thing I am having trouble with is I woudl like to display "disabled" images when there if...
5
by: Brad | last post by:
I created a base page class which sets a response filter and the filter injects additional html into the response output stream. The filter works fine and everything works as expected except for...
1
by: Terry Olsen | last post by:
Is there any way to disable the client browser "Back" and "Forward" buttons while on my site? Or how would I go about knowing that a page hit is caused by a back/forward navigation? I have...
1
by: Johnny Emde | last post by:
Hello I want to avoid users to be able to click back/forward in IE. Is it possible to like clear the 'back-container' and ofcause the 'forware-container' or just disable the buttons. I'am...
1
by: Badass Scotsman | last post by:
Hello, I have an application which should never allow the back button to be pushed without refreshing the previous page. For example: Step 1: User fills in form.html and presses submit ...
3
by: whapts3 | last post by:
I'm putting together a rather dynamic page (AJAX/all-that-mess). So... to go between different sorts of content on the page, I have it set up something like this. <a href="#10"...
0
by: sahaja108 | last post by:
Hello. I was wondering if it possible to detect a Browser Back/Forward by PHP. I mean. I am in page A, I go to page B and then I click on the Back button and I return to A. Does it exist a php...
4
by: John | last post by:
Hi everybody, for my web-application (it must currently work only under IE6) I have a servlet that intercepts user's HTTP GET requests for a typical search result page, which contains a paging...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.