473,964 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4562
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_ref6 3.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
15612
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 key which IE interprets as a desire to return to the previous page. Thanks
17
50334
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 backspaces. Anyone have experiences with this?
2
4588
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; switch (evt.keyCode)
44
19650
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 = getchar()) == '\b' ) but this doesn't work. It's as if '\b' is not allowed to come into stdin. So how else can I
0
6905
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 Backspace key to work. Bill
9
34922
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. How can I do this? <script language="JavaScript" type="text/javascript"> <!-- function onKeyPressBlockNumbers(e) {
0
1554
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 characters, which I need to somehow use to erase the most recent character displayed in the last line displayed in the text box. Of course, the backspace must only apply to the last line and must not back up into the previous line once all characters...
1
6268
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 cannot use IF/ELSE statement. ============================== <form> <textarea name="event_description" ONKEYPRESS="if (document.layers)
2
1690
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, I had a heading 1 centered on a page. Right under that I had some words in smaller print right under the heading. When I hit enter after the heading 1, it automatically put the text right below it in a <p></ptag. I don't want this sort of stuff to...
0
10307
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10127
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11357
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10844
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10039
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6350
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6499
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5100
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
3
3709
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.