Etienne Marais said the following on 12/4/2005 5:36 AM:[color=blue]
> Randy Webb wrote:
>
>[color=green]
>>Dan said the following on 12/3/2005 9:02 PM:
>>[color=darkred]
>>>Is there a way to obtain the last page visited? I don't want to go to
>>>that page, I just want to be able find out what page they came from,
>>>the url of that page. Is this possible?
>>>[/color]
>>
>>No. And thankfully so. You can try document.referrer but it won't
>>always tell you what page they came from.
>>
>>Why do you want to know where I came from?
>>[/color]
>
>
> Found this:
> (
http://www.samspublishing.com/librar...urs&seqNum=100)[/color]
Forget you found it.
[color=blue]
> ////// COPY & PASTE :
>
> The history object is another child (property) of the window object. This
> object holds information about the URLs that have been visited before and
> after the current one, and it includes methods to go to previous or next
> locations.[/color]
But it does not tell you where you are in that list.
[color=blue]
> The history object has one property you can access:
>
> * history.length keeps track of the length of the history list—in other
> words, the number of different locations that the user has visited.[/color]
But it will not tell you if the page has previous or next entries. Only
how many are in that list.
[color=blue]
> Note
>
> The history object has current, previous, and next properties that
> store URLs of documents in the history list. However, for security reasons,
> these objects are not normally accessible in today's browsers.[/color]
Pay close attention to the above as it says exactly what I said.
[color=blue]
> The history object has three methods you can use to move through the history
> list:
>
> * history.go() opens a URL from the history list. To use this method,
> specify a positive or negative number in parentheses. For example,
> history.go(-2) is equivalent to pressing the Back button twice.[/color]
Only if there are 2 pages to go back to. And you have no way of
detecting that using script.
[color=blue]
> * history.back()loads the previous URL in the history list—equivalent to
> pressing the Back button.[/color]
Only if there is a page to go back to.
[color=blue]
> * history.forward()loads the next URL in the history list, if available.
> This is equivalent to pressing the Forward button.[/color]
Finally, it says they work "if available". Again, forget you found that
site and find a better one.
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/