Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

history(-2 or more)? 1

Status
Not open for further replies.

smashing

Programmer
Oct 15, 2002
170
US
Is it possible to use the history button to go back more than one page?
I tried changing the value inside the ( ) (see example below) but doesn't seem to help.


please click <a href=&quot;&quot; onclick=&quot;history.back(-2); return false;&quot;>here</a><
 
smashing, try onclick=&quot;history.go(-2);

I have this little thing, Advanced Delusionary Schizophrenia with Involuntary Narcissistic Rage. It's no big deal really...
 
Is there a way to set the actual browser "back" button to go back 2 pages when clicked?
 
the previous property is stated as "referring" to the history "list"

so I would guess you could read the -2 as

window.history.previous(-1)

I was going to experiment to see if I could copy the previous() to previous(-1) because I do a redirect for framebusting purposes BUT the script I found does that for JavaScript 1.1 not 1.0 and the previous property is 1.1 and later. Ho Hum
 
OldWilly, as far as I know, you do not have the rights to modify the users IE toolbar, like change number of pages the 'Back' button goes to. That would be a security issue.


____________________________________
Just Imagine.
 
It's a security issue because if you changed the BACK button value to something other than -1, you might not get the chance to change it back to it's default value (user closed the browser, loss of power, loss of network/internet connection.) In that case, the BACK button value would remain at whatever you set it. So, a malicious site could set the value to something like -25 or -40 and really frustrate the user.

There's always a better way. The fun is trying to find it!
 
My script (From Grizzly) states that the method used redirects the browser to bust the frame and Java 1.1 (and up) prevents the history from including the intermediate URL. That way My homepage goes to a clean page but the back button returns to the original calling page. Not sure how but they say it does it from the inherent function of the instructions used. In Java 1.0 (there are two versions of the subroutine - the browser chooses the latest it can use) the instruction is different and cannot do this.

My question is
If you cannot get at the |address bar - how come the frame I bust out of holds the original URL. Is this because it is "top" level?
 
Java = JavScript in my language, sorry if I was swearing. I have done scripts in PageMaker which are called Java - all too confusing.

My Bible is Pure JavaScript by Allen Wycke etal - it says so much but not everything.
 

Java != JavaScript, at any time, any place, or anywhere. They are really totally different languages.

I am constantly fighting battles at work with people who give me Java work to do, just because I'm a Javascript developer. They see the first 4 letters are the same, and *bang* - 2+2 suddenly equals 5... I guess I was just surprised that a Javascript developer would make the same mistake.

Dan
 
Java != JavaScript, at any time, any place, or anywhere. They are really totally different languages.

Well put!

There's always a better way. The fun is trying to find it!
 
A simple way of remebering differences between Java and JavaScript is that Java is object-oriented and JS is not.

Simple, sweet, and to the point.


____________________________________
Just Imagine.
 

While Javascript may not force OOP upon the user, I would say that it can be very much an object oriented language, should you, the programmer, choose to use it as such.

While things like Strings, Dates, Arrays, Windows, etc are all objects which are very much core to using Javascript, these alone would probabaly make it an object-based language, but I would say with all the prototyping facilities available to us - that can be used to easily implement inheritance, etc - make it more of an OOP language.

Have a play with prototyping - you can achieve some remarkable results. I don't remember where I found it, but one of the old Netscape Javascript Guides (I have it as a PDF) really goes into fantastic detail about Javascript and what it is capable of... I still haven't read anything recent that explains it in such detail.

I could be wrong on the OOP thing, but in my experience, most people who say they are Javascript coders have no idea of the true potential of Javascript. Don't take that personally, as I'm not having a dig at you, just saying it how I've expereienced it ;o)

Dan
 
Sorry sorry sorry if my lazy typing offends I promise to say three "Hail Time Berners-Lee's"
[ignore]</THREADDRIFT>[/ignore]
It still doesn't solve the BACK button problem I may have solved in thread History.back() but knowing MS I suspect IE6 & 7 probably behave differently.

basically redirection adds one extra history entry and "history.back()" seems to go back two (in IE5.5 it does)
any comments on the method visa vis other browsers/versions?
 
>> "Java is object-oriented and JS is not"

au contrare, mon ami

js IS object oriented, it just lacks true inheritence like Java has.

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
js IS object oriented, it just lacks true inheritence like Java has.

Hmmm, I guess all the JS books i've dwelt on musta made a mistake, :-/


____________________________________
Just Imagine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top