Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Using history.go() to get to the *last* item in the history

Reply
Thread Tools

Using history.go() to get to the *last* item in the history

 
 
Niall
Guest
Posts: n/a
 
      12-04-2006
When I say 'last', I mean (eg.) the 100th item in a 100-item history
list, *not* the immediately previous one!


The problem is, the history.go() method only allows *relative* movement
through the history list. I need to go directly to the end -- an
*absolute* movement -- and there doesn't appear to be any way of
finding out the number of 'steps' that would require.

Ideally, what I would use would be something of the form:

history.go(history.length - history.mythic_current_position_attribute);

....but that attribute appears to be a product of my fevered
imagination, or at least isn't documented anywhere.

Can anyone help? The idea is that if anyone uses the drop-down 'go back
many items' control in their browser, the site immediately bumps them
forward to where they came from; currently I have this implemented as
history.go(+1) at the top of each page, but this can end up with a
chain of 10+ page requests, which is rather too easy to interrupt.

(Aside: why do I keep getting 'permission denied' errors when I try to
access history.current via Firefox?)


Thanks in advance,

Niall

 
Reply With Quote
 
 
 
 
pcx99
Guest
Posts: n/a
 
      12-04-2006
Niall wrote:
> When I say 'last', I mean (eg.) the 100th item in a 100-item history
> list, *not* the immediately previous one!
>
>
> The problem is, the history.go() method only allows *relative* movement
> through the history list. I need to go directly to the end -- an
> *absolute* movement -- and there doesn't appear to be any way of
> finding out the number of 'steps' that would require.



There's a reason for this. You're bumping into the walls of the
browser's sandbox meant to keep your site relatively isolated from the
user's private data. Imagine if the history was accessible....

Welcome Mr. Smith. Amazorn.net is your one button shopping experience.
We see that you recently visited monkeyspankingsex.com, there will be an
additional $100.00 charge to your account tonight unless you'd like us
to email Mrs. Smith your browser history.

Ewww.

Since you appear to want to navigate only within your own site, you can
make your own history model with the use of cookies. That's a lot of
work really (and probably why people responsible for browser standards
weren't falling all over themselves to make the history list more
accessible for in-site navigation). If you decide to implement cookies,
remember there's a size limit per site (off the top of my head I'd say
it's 4k) and a lot of (very smart) people surf with cookies OFF unless
deliberately turned on, on a site-by-site basis.

---------------------------------------------------------------------------
http://www.hunlock.com -- Permanently under construction (And proud of it!)
$FA
 
Reply With Quote
 
 
 
 
Niall
Guest
Posts: n/a
 
      12-05-2006
pcx99 wrote:

> There's a reason for this. You're bumping into the walls of the
> browser's sandbox meant to keep your site relatively isolated from the
> user's private data. Imagine if the history was accessible....


I thought that might be the case. Ah well...

> Since you appear to want to navigate only within your own site, you can
> make your own history model with the use of cookies.


Not exactly; the idea is that someone who leaves the site shouldn't be
able to get back to it using the back button (it's a secure office
productivity web app, and we can't rely on the users logging out
properly if they leave the site, then wander away from their desks with
the browser still open), however I might be able to come up with
something similar.

Ta much...

 
Reply With Quote
 
Niall
Guest
Posts: n/a
 
      12-06-2006
Update - because Internet Explorer (6, anyway, and we can't support 7
yet) doesn't send referer info with JavaScript page requests, a
referer/request checking system doesn't work either.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Values entered in the Form disappears when using the history.go(-1) or history.back() sujith.bolar@gmail.com Javascript 2 10-17-2006 08:12 PM
embedding python: simulating sequence get item / set item methods Johannes Zellner Python 1 01-17-2006 01:09 AM
Recover Firefox web search history with history set to 0 days Sudip Chakraborty Firefox 2 11-21-2005 06:47 PM
[ANN] irb-history 1.0.0: Persistent, shared Readline history for IRB Sam Stephenson Ruby 1 06-18-2005 08:56 AM
history.dat, formhistory.dat - deleting deletes history? S.Rodgers Firefox 4 05-05-2005 01:03 AM



Advertisments