473,761 Members | 9,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tell is this is back page in the history

Hello,
How can I tell if there is a page to go back to in the history or
not??? Same with forward??? say something like///

if (there is a page to go back to ) {
// DO something
}else {

}

and simularly

if(there is a page to go forward to ) {
//DO something else
}else {

}

Thanks,Pam

Nov 7 '05 #1
10 8873
pm******@uwater loo.ca said the following on 11/7/2005 1:41 PM:
Hello,
How can I tell if there is a page to go back to in the history or
not??? Same with forward??? say something like///


You can't.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 7 '05 #2
VK
pm******@uwater loo.ca wrote:
Hello,
How can I tell if there is a page to go back to in the history or
not??? Same with forward??? say something like///

if (there is a page to go back to ) {
// DO something
}else {

}

and simularly

if(there is a page to go forward to ) {
//DO something else
}else {

}


// To go back:
history.go(-1);
// history.back() method is OK too, but
// it's sometimes blocked on some browsers
// for some misterious security reasons.

// To go forward:
history.go(1);
// history.forward () method is OK too, but
// it's sometimes blocked on some browsers
// for some misterious security reasons.

If no page to go back or forward, user will stay on the current page,
no error will happen, so don't worry.

history.length will give you some idea about how much did user navigate
before she came here. Only "some idea" because this counter has some
limitations too numerous to describe them here. But if you really want
to - then you can:

if (history.length ) { // at least one page before mine
history.go(-1);
}

Nov 7 '05 #3
VK said the following on 11/7/2005 6:12 PM:
pm******@uwater loo.ca wrote:
Hello,
How can I tell if there is a page to go back to in the history or
not??? Same with forward??? say something like///

if (there is a page to go back to ) {
// DO something
}else {

}

and simularly

if(there is a page to go forward to ) {
//DO something else
}else {

}
// To go back:
history.go(-1);
// history.back() method is OK too, but
// it's sometimes blocked on some browsers
// for some misterious security reasons.


Only if there is a page to go back to, and you have no reliable way to
determine that.
// To go forward:
history.go(1);
// history.forward () method is OK too, but
// it's sometimes blocked on some browsers
// for some misterious security reasons.
Only if there is a page to go forward to, and you have no reliable way
to determine that.
If no page to go back or forward, user will stay on the current page,
no error will happen, so don't worry.
But they will have a broken link which indicates incompetence on the
part of the programmer.
history.length will give you some idea about how much did user navigate
before she came here. Only "some idea" because this counter has some
limitations too numerous to describe them here. But if you really want
to - then you can:
No you can't, you just think you can.

if (history.length ) { // at least one page before mine
No, it means there is a length to the history.

Open page1.html, navigate to page2.html, press the back button to go
back to page1.html. Check history.length. Then, read my response and
believe it.
history.go(-1);
}

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 7 '05 #4
VK wrote:
history.length will give you some idea about how much did user navigate
before she came here. Only "some idea" because this counter has some
limitations too numerous to describe them here. But if you really want
to - then you can:

if (history.length ) { // at least one page before mine
history.go(-1);
}


history.length gives exactly no indication whether there is a previous (or
next) URI in the history or not. For example, it yields 50 in my (TBE
enhanced) Firefox no matter which site in the tab's history I am visiting.

I am not surprised by that:

<http://docs.sun.com/source/816-6408-10/history.htm#119 3301>
PointedEars
Nov 7 '05 #5

pm******@uwater loo.ca wrote:
Hello,
How can I tell if there is a page to go back to in the history or
not???


Even if there were a property like 'history.curren tIndex' it would
represent the entire browsing history of the current window, not just
that of the pages visited on your site.

--
S.C.

Nov 8 '05 #6
i would just like to know for the window.. i am developing a web
application (using asp .net/visual basic .net/javascript) right now and
have back/forward "buttons" (really just images linked to
history.back()) in a pop up window used for help and I want to display
a different "greyed" out image when there isn't a page to go
back/forward to.

Nov 8 '05 #7
i would just like to know for the window.. i am developing a web
application (using asp .net/visual basic .net/javascript) right now and
have back/forward "buttons" (really just images linked to
history.back()) in a pop up window used for help and I want to display
a different "greyed" out image when there isn't a page to go
back/forward to.

Nov 8 '05 #8
pm******@uwater loo.ca said the following on 11/7/2005 9:10 PM:
i would just like to know for the window.. i am developing a web
application (using asp .net/visual basic .net/javascript) right now and
have back/forward "buttons" (really just images linked to
history.back()) in a pop up window used for help and I want to display
a different "greyed" out image when there isn't a page to go
back/forward to.


Must not be much of an app if you haven't figured that out yet. Create
your own history trail and track. Either in a cookie, on the server, or
in the page itself.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 8 '05 #9

pm******@uwater loo.ca wrote:
i would just like to know for the window.. i am developing a web
application (using asp .net/visual basic .net/javascript) right now and
have back/forward "buttons" (really just images linked to
history.back()) in a pop up window used for help and I want to display
a different "greyed" out image when there isn't a page to go
back/forward to.


Just out of curiosity, is there any particular reason you think your
users need two sets of back/forward buttons?

-- David

Nov 8 '05 #10

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

Similar topics

2
18099
by: Kim Therkelsen | last post by:
Hi! By pressing a button I am directed from one page to another. At the second page some things displayed on the first page are changed and now I want to go back to the first page again. The pages are written in php. If I use javascript:history.back() I get back to the first page but I have to manually reload it to see the changes I have made. The solution could be:
3
2765
by: Nick Tew | last post by:
Hi, Firstly, any help would be gratefully received. Im using several iframes on a single page and would like individual 'back' and 'forward' buttons located in each of the iframes which only relate to the information inside the iframe. Ive managed to put 'back' and 'forward' buttons on each of the iframe's by using:
6
2217
by: Rich | last post by:
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.
3
1883
by: riotctrl | last post by:
Is there a way to use the history.back to display the actual url of the last page to the page ?
3
9219
by: woodsie | last post by:
i'm looking for a back script that will work in Safari (on mac). the one below works fine in IE and netscape but not safari. <a href="#" onClick="history.go(-1)">go back</a> any help plz?
1
5418
by: HandersonVA | last post by:
I used <input type="button" value="Back to Correct" onclick="window.history.back();"> to go back to the previous page is working, but if i use the as below instead, it does not work. what did I do wrong? <a href="javascript:document.testform.newid.value='New';" class="btn1-text" onclick="window.history.back();">Back to Correct<a>
1
2093
by: Chris Uwins | last post by:
Hi there, i know theres a number of ways I can achieve this but want to know the best, (but still quite simple). Up until a year ago I never used Access but have designed a few databases for work. I am working on Access 2000. I have basic SQL/VB skills - and am pretty accomplished at putting the databases together. Anyway...I've created a database to keep track of "Dayworks" we are
2
11080
by: Lubo¹ ©lapák | last post by:
Hi, I need (in one function in aspx page) return the WWW browser back to previous page. How can I do it? Thanks
2
2405
by: sujith.bolar | last post by:
Hello I am using a <form method="post"to submit values to the processing agent. If the processing agent returns an error, I call the history.go(-1) or history.back() function to reload the page. The page does reload but all the values entered disappears. I am using Java Script and html. Code: ---------------------
0
10136
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...
0
9988
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...
1
9923
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
8813
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...
1
7358
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
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
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3911
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
2788
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.