Solved

history location

Posted on 2006-10-19
5
747 Views
Last Modified: 2008-01-09
Ever big with asking simplistic nonsensical questions. Here's another one for you knowledgeable Javascripters. I know that I can do history.go(-1) or history.go(1) yada yada. Can I see the location or whatever value there is for those pages? like if I have page1.html, page2.html, page3.html. Is there a way I can see page1 as previous and page3 as next from page 2? Assuming i've been to all three pages.

Thanks!
Audrey-Rose
0
Comment
Question by:arvanhalleorg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 2

Author Comment

by:arvanhalleorg
ID: 17768254
Hmm. The source of the page makes no sense whatsoever to me. I've no idea what half, if not most of it, means. Is there something simpler that just says 'okay this is previous value and this is next'?
0
 
LVL 2

Author Comment

by:arvanhalleorg
ID: 17768270
Putting up the points cause I need this to put into the page I'm working on currently.
0
 
LVL 16

Accepted Solution

by:
hankknight earned 500 total points
ID: 17772275
In short:
Technically, JavaScript can support this.  However many browsers do NOT because of security/privacy concerns.

This page shows how it can be done:
http://www.greymagic.com/security/advisories/gm005-op/

Here is the code that works in some browsers, including Opera:

<script>alert("Last URL: "+history.previous+".\nNext URL: "+history.next+".")</script>




Here are a few more tests:



<HTML>
<BODY>
<FORM>
<p>Interesting Features</p>
<p>
<INPUT TYPE="button" NAME="Activity" Value="Pages Visited This Session" onClick="alert('Pages in history for this session: '+window.history.length)">
<INPUT TYPE="button" NAME="GoBack" Value="Go Back One Page" onClick="window.history.back()">
<INPUT TYPE="button" NAME="GoForward" Value="Go Forward One Page" onClick="window.history.back()">
<INPUT TYPE="button" NAME="GoGoogle" Value="Go to Google" onClick="alert('This interesting feature will take you back to the point in your historty that you visited http://www.google.com\nIf you did not visit Google.com in that session it will not go anywhere.');history.go('http://www.google.com')">
</p>
This works on Opera
<p>
<INPUT TYPE="button" NAME="Test" Value="View History" onClick='alert("Last URL: "+history.previous+".\nNext URL: "+history.next+".")'>
</FORM>
On some older versions of Netscape this will work:
<SCRIPT Language="JavaScript">document.writeln("<B>history is</B> " + history);</SCRIPT>
</p>
</BODY>
</HTML>
0
 
LVL 2

Author Comment

by:arvanhalleorg
ID: 17772541
ah, i guess it doesn't work on IE 6 then :/ ah well
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question