Thanks in advance!
05-06-2007, 08:07 AM
Why do you want to do that? Sounds as though the site might be something disreputable.
The browser history is protected and cannot exposed to script for anything other than going back and forward. It would leave people vulnerable to privacy violations.
05-06-2007, 04:26 PM
Philip: No, I know it is possible to do with this script:
But what I would do with that script is beyond me.
05-06-2007, 04:59 PM
You can't put a url in the history that the user hadn't traveled too. What replace does is allows you to avoid putting your own history in. I believe the way it works is like this.
Suppose your history was
and the went to your site. Then the user clicks on a button on your site that does
location.href = "www.msn.com";
sends them to www.msn.com so the history would look like
location.replace("www.msn.com") then the history would look like
So the function replaces your spot in the url history with the one you want to go to. I believe one design theory for using it is when you have a page and all it does is forward you to another page (like after a post message). It can make a more appropriate user history conforming to what the user would expect instead of what actually happened.
I've never used it myself so it's possible there are more restrictions on its use.
05-06-2007, 06:57 PM
What I need to know is how I would incorporate this into a button...
<form name="jump" id="jump" method="post" action="" enctype="multipart/form-data">
<input type="button" name=".button" id=".button" value="Google" onclick="location.replace('http://www.google.com/')" />
As David said and you noted, it does replace the current page with the target location in the browser history. There are legitimate reasons when you would not want a 'back button' to access a previous page.