473,662 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to determine the prior page (i.e. page the back button will go to)

Am just beginning to use javascript.

I have some pages that can be arrived at from more than one other
page. Yes, the user can use the back button but I'd like to have a
back link at the bottom of the page.

Thought there would be a url in referrer but it seem to be empty.

Jul 20 '05 #1
6 2143
<a href="javascrip t:history.back( );">Previous Page</a>
Jul 20 '05 #2

Sorry, acts at once in html. Simply replace ... with < before and with >
after line.

....a href="javascrip t:history.back( );">Back to index</a...
Jul 20 '05 #3
Rich <r.****@verizon .net> wrote in message news:<mt******* *************** **********@4ax. com>...
Am just beginning to use javascript.

I have some pages that can be arrived at from more than one other
page. Yes, the user can use the back button but I'd like to have a
back link at the bottom of the page.

Thought there would be a url in referrer but it seem to be empty.


If you get an answer send me a notification. I have the same problem.
Jul 20 '05 #4
On Sat, 24 Jan 2004 08:40:20 GMT, Maarten <no****@pandora .be> wrote:
<a href="javascrip t:history.back( );">Previous Page</a>


Don't use the JavaScript pseudo-protocol when you don't need to. Consider
what will happen when JavaScript is disabled.

To the OP:

Creating your own "Back" link that doesn't go to a fixed location can be a
bad idea. For a couple of reasons:

- If the user has JavaScript disabled, your link will do absolutely
nothing and frustrate the user.
- If the user goes directly to the page (from their history, or a
bookmark), going "back" is meaningless and it makes your site unnavigable.
I come across this frequently, and it's very annoying.

If the user wants to go back through their history, let them use the
appropriate button. However, if you insist on creating your own link, use:

<a href="anActualP age.html" onclick="window .history.back() ; return
false">Back</a>

You'll have to choose a sensible location for "anActualPage.h tml", which
should be a common root for all of the possible referring pages (like the
main site page). Note that this solution will still leave the second
problem above unresolved. Only a fixed address, with no JavaScript
interrupting the link, can solve it.

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #5
Maarten wrote:
Sorry, acts at once in html. Simply replace ... with < before and with >
after line.

....a href="javascrip t:history.back( );">Back to index</a...


Please read the FAQ:
http://www.jibbering.com/faq/
All of it.
With special attention to Sections 2.3 and 4.24

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/

Jul 20 '05 #6
See history object, his property and methods.
In addition to prev responses, i can add that you can specify how many
steps to move back/forward i.e. history.go(-3) and even to build menus
with visited links if you wish.

http://devedge.netscape.com/library/...e/history.html

Peter

Rich <r.****@verizon .net> wrote in message news:<mt******* *************** **********@4ax. com>...
Am just beginning to use javascript.

I have some pages that can be arrived at from more than one other
page. Yes, the user can use the back button but I'd like to have a
back link at the bottom of the page.

Thought there would be a url in referrer but it seem to be empty.

Jul 20 '05 #7

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

Similar topics

6
3326
by: laura | last post by:
I'm doing a page which gathers some text in the form of a text box in a <form>. This text is saved to a text file, notices.txt and I want to be able to display the saved text on the page, as soon as they click the SUBMIT button - is this possible? At the moment I have a hyperlink called "back" which, once they have entered the text and they click SUBMIT, the "back" hyperlink will refresh the page and it displays the newly entered text....
2
4333
by: James | last post by:
I've been to websites where if I navigate off a form, trying to get back to it by hitting the back button gives me a page which says "Warning, page has expired". It doesn't display the page. I've been searching around trying to get this to happen for one of my aspx pages and I can't get it to expire. I've put the following HTML tags in the page: <meta http-equiv="expires" content="Sun, Dec 31 1970 12:00:00 GMT"> <meta...
8
2566
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and courses are populated. When course is selected, lists of occurrences, groups and
7
2030
by: Tom wilson | last post by:
I have created a very simple example that doesn't work. Form1 contains a textbox and a button: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Response.Redirect("login.aspx") End Sub Very simple. Forget what login.aspx does, it's just somewhere to redirect to.
1
1105
by: H. Williams | last post by:
Is it possible to determine if the Back Button on the browser is enabled? I need to know if the page was called in a new window (for example with HREF target='_blank' or by clicking 'Open in New Window') In these cases the Back Button would be disabled. Thanks.
5
4276
by: TS | last post by:
Is there a way in debug mode to determine what event caused the postback to occur without having an event handler for that event? thanks
0
1005
by: KY Lui | last post by:
I am developing a simple message sending application. A page (message.aspx) is used for message writing and message status confirmation. eg. A user access message.aspx to write a message, a send button should be clicked to send the message. Postback is occurred. Message.aspx will be used again to show the confirmation message. I encounter a issue in this stage? As i understand, all event handlers will be executed after all page_load...
4
13177
by: VB Programmer | last post by:
When I run my ASP.NET 2.0 web app on my dev machine it works perfect. When I precomile it to my web deployment project and then copy the debug files to my web server I get this problem when trying to login (obviously it's using ASPNETDB.mdf). Any ideas? Server Error in '/' Application. --------------------------------------------------------------------------------
4
3519
by: bendlam | last post by:
I have a page that contains search criteria and when you click on the search button it causes a post back that populates a dataview on the same page. One of the gridview columns contains a link that navigates to a details page. When I try to go back to the search results page i get "Page cannot be displayed" error. How do i go back to the search results and have the search criteria and dataview unchanged? i.e. The behaviour I'm...
0
8432
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
8344
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
8857
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8546
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7367
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
5654
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
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
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.