Forum Moderators: open

Message Too Old, No Replies

javascript:history . go (-1)

         

finlander

7:22 am on Mar 4, 2011 (gmt 0)

10+ Year Member



I have an interesting requirement for this method.

I have some PHP pages that may or may not have a string attached to the page, such this:

http://example.com/img/galleries/index.php?sfpg=KiphNDVmMGNjMTYxNmRiY2M3ZmFlNzE4ZTJmY2Q3NDNlOA


versus this:

http://example.com/img/galleries/index.php


The page with the string is always reached by the visitor AFTER reaching the page w/o the string.

If the visitor is on the page with the string, then the javascript history.go method will only return the visitor to the page without the string, which is not what I want, whereas if you are on the page w/o the string, you will really go back to where I want the visitor to go.

Maybe there a way of adjusting the history.go method to say, effectively, "ignore the string and go back to the most recent ACTUAL page prior to index.php." ?

There is no way of knowing for sure which of these two pages a visitor will be on when he pushes the 'back to site' button on my site. But they are both the index.php page, so I thought there must be a way of modifying history.go to work in this case.

? thanks...

[edited by: coopster at 1:54 pm (utc) on Mar 4, 2011]
[edit reason] you can use example.com for examples if you like [/edit]

daveVk

9:04 am on Mar 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



using location.replace() when going to "string" pages will override the current URL in history.

finlander

10:09 am on Mar 4, 2011 (gmt 0)

10+ Year Member



thank you, that seems that it might work if I could use that method when GOING to a string page, but in the php I am using, I don't know that I could control the "going to" string page while using that method.