Forum Moderators: coopster

Message Too Old, No Replies

A Navigation Back Button but without using IE History

Back without using history.back()

         

cunningmark

7:06 pm on Feb 3, 2005 (gmt 0)

10+ Year Member



I need to create a Back button, which would work the same as the history.back().
e.g.
<SCRIPT TYPE="text/javascript">
<!--
var bl = new backlink();
bl.type = "image";
bl.src = "gprevious.gif";
bl.text = "previous";
gb.write();
//-->
</SCRIPT>
Unfortuantly the sytem in need to create it on uses HTM Help, and has been heavily restriced.

Nav Bar disabled (browser back/forward disabled)
No print
No popup
No context (right click stuff)

With these chanes on is it still possible to mimic this action locally.
I.e. A Temp stack created and the top item called off when the prev/back button is hit.
With some sort of deletion in the stack to stop loops.
Is it possible using either PHP or aspx

mincklerstraat

1:52 pm on Feb 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, you'd want to save this temporary stack as a $_SESSION varaible in an array, and have some kind of pointer variable also in the session to show you where the current user is in the history. Then just have a back and next link to the last / next elements in the array, with an extra parameter flag to indicate that the user got there using the back or forward functions. If the flag isn't set, you add that page's url to the history array - either at the pointer number value, or else at the end if the user hasn't gone 'back' yet or is at the end of the history array. You can just limit the array to n elements to keep it from getting out of control.