473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Hitting Backspace to return to a previous page...


What event gets fire off?

I thought it might be an onLoad event, but that doesn't seem to be the
case.

(I have some variables displayed on my page that, upon a Backspace (or
even hitting the Back button, I suppose) doesn't reset to zero.)
Sep 22 '05 #1
3 4537
Dave Christian wrote:
What event gets fire off?
Do not assume that whoever is reading your post can simultaneously see
(or remember) the subject.

I thought it might be an onLoad event, but that doesn't seem to be the
case.

(I have some variables displayed on my page that, upon a Backspace (or
even hitting the Back button, I suppose) doesn't reset to zero.)

I guess you mean is an onload event triggered in a page visited using
'backspace'. That may depend on the browser and possibly its configuration.

Firefox 1.0.6 and IE 6 seems to run onload whenever the page is visited
regardless how it is arrived at - by link, back button, alt+left arrow,
backspace, etc.

But I seem to remember that wasn't always the case in all versions.

window.onload is part of DOM 0, so there is no public specification of
how it should work.
Mozilla documentation states:

"The load event is fired at the end of the document loading process.
At this point, all of the objects in the document are in the DOM."

<URL:http://www.mozilla.org/docs/dom/domref/dom_window_ref63.html#1018577>

Microsoft says::

"To invoke: Load the persistent Web page from a favorite or shortcut
or through an Internet address."

<URL:http://msdn.microsoft.com/workshop/author/behaviors/reference/events/onload_1.asp>

--
Rob
Sep 22 '05 #2
I doubt any events actually get triggered as you enter the "old" page
again via back/backspace, because the browser most likely just displays
the cached version.
This is an issue which bugs webprogrammers all over the world, because
it poses some annoyances - especially with unexperienced web users -
which needs to be taken care of.

There are some tags you can write on the top of your page (expires and
no-cache etc) to try and force the browser to reload the page content
each time, but they don't work 100%. There are also other tricks which
can be used, but I've yet to find a 100% solution, but I'd advice you
to do a search for avoiding cahcing in the browser, and you'll see it
is quite discussed subject.

Sep 22 '05 #3
On IE 5-6, onload() always gets fired when you back-button to a page.
Also, onBeforeUnload() and onUnload() always get called on the page
you are coming from.

If you want to make sure variables are set to 0, initialize them in the
onload() of the page. Quite often, developers have the opposite
problem. They want variables be the same as the user left them. Form
fields will remain the same unless you initialize them in onLoad.

Works exactly the same in Firefox but does NOT in Opera. This may
explain the "speed" of Opera (they do no reload the DOM I guess) but in
my opinion, makes it deficient.

Sep 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Robert Nurse | last post by:
Hi, Is it at all possible to capture and suppress the backspace key when focus is not on a form edit control? Basically, while the page is loading I don't want the user pressing the backspace...
17
by: Julia Briggs | last post by:
Are there any gotchas using if (event.keyCode==8)? I understand that to represent backspace, but it doesn't work. I am running Windows XP, using a typical keyboard - but no luck in detecting...
2
by: Eli | last post by:
Hi, Since using IFRAMEs in my page, I want to disable the F5 and BackSpace keys. I got this working on IE but not on Mozilla Firefox: function CheckKey(evt) { evt=(evt)?evt:window.event;...
44
by: G Patel | last post by:
Hi, I would like to write a program that checks to see if the user has hit backspace (so the program can go back to a previous stage). How would I test for this? I tried if( (c =...
0
by: Bill1312 | last post by:
Hi I am trying to get an textbox control to work. All of the Key.values are working all except for the Backspace key I have the char value set to 8 Is there a different way of getting the...
9
by: Laphan | last post by:
Hi All I'm using the below to limit the input into a text box to just letters, numbers, hyphens and full stops, but I also need to allow the backspace, delete and arrow keys to come through. ...
0
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a scrolling RichTextBox to which I add characters one at a time using the AppendText method as they are received by my application. Some of these characters may be backspace...
1
by: Blue | last post by:
This JS limits the input characters into the form. How do I modify it so that it also allows CARRIAGE RETURN and BACKSPACE (for making text correction)? Due to the template engine I am using, I...
2
by: Sunfire | last post by:
I was wondering if there was a way to hit enter to insert blank lines while in the designer? I tried this but all it seems to want to do is insert code that really shouldn't be there. For example,...
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
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...
0
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,...
0
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...
0
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,...
0
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...

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.