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

N

Niall

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
 
P

pcx99

Niall said:
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.
 
N

Niall

pcx99 said:
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...
 
N

Niall

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top