Click to See Complete Forum and Search --> : Setting Back Button History
Kruez
12-04-2002, 06:43 PM
I need to set the the page the browser will go to when the back button is pressed. Any ideas on how to do this with javascript without using the location.replace method? Also, is there any way to determine when the back button has been pressed and run a function because of it? Thanks!
Zach Elfers
12-04-2002, 07:07 PM
I'm not sure exactly what you mean, but this will give you a back button <a href="javascript:history.back(-1);">Back</a>.
Kruez
12-04-2002, 07:11 PM
What I have is a web application that I need to return to the main page whenever the back button is pressed in the browser. I also can't disable the back button and provide my own.
spufi
12-04-2002, 10:05 PM
Stupid question time. Why on earth would you want to do this? If you want people to be one click away from the main page, then have a link to the main page on all of your pages. If you overwrite the back button you take away a major feature of a browser. What if someone is five pages deep into your site and they need to go back one page? You want to send them back to the main page so they can click through four pages just to get where they wanted to be?