473,549 Members | 3,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

acoder
16,027 Recognized Expert Moderator MVP
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 11816

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

Similar topics

3
1792
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 there isn't a page to go back/forward...how would I go about doing that??? Pam
5
1728
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 the following quirk: When I navigate my browser to another url (a link in the page, a browser favorite...it doesn't mater) and then use the...
1
6004
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 discovered that my web app is definately NOT Back/Forward safe. It's really messing with my SQL data bigtime. Thanks.
1
2883
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 using C# Kind regards
1
6707
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 Step 2: User see's results.html and clicks back to amend form
3
6239
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" onclick="loadFragment()"> ... </a> <a href="#20" onclick="loadFragment()"> ... </a> where loadFragment is a function which does something based on the #20 which...
0
1671
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 function that detect that I have used the Back button? Thank you very much
4
6258
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 mechanismus for navigating between the result pages (e.g. << 1 2 3 4 5 ... >). When the user clicks on this navigation, the JSP send a GET request to...
0
7718
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6041
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1936
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.