Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

location.replace issue...unable to use back button

Status
Not open for further replies.

gio2888

Technical User
Oct 26, 2000
64
0
0
US
Hi, I am using a top.location.replace("url") but when I use the back button I get to the same page, is there a way to use the history object to set the previous state to any url? Please let me know what the correct syntax for it, cause I tried doing top.location.history = "url". Please Help Asap, I am running out of time. Thanks in advance, I appreciate your help.
 
Didn't quite understand your question. Let's say you are in URL1 and you have written location.replace(URL2) in URL1. In that case, the URL1 will not be stored on the browser history. Now what exactly are you doing in URL2? Are you redirecting to some other page? If you are, then pressing the back button will result in the same page again and again. What exactly are you trying to do? Any examples?
 
I need to go back to url1 by using the back button...sorry for being confusing.
 
Well, if you write location.replace in URL1, you cannot go back to that url because it will not be stored in the browser history. You have to write top.location.href=URL2, to keep URL1 in the history. But again, what are you doing in URL2? are you using some server side code in URL2 to redirect to say, URL3?
 
theres no url3....just url1 and url2. I can t really explain it to clearly, cause I am working for a hospital. Thanks for your help anyways!

 
in that case, top.location.href=url2 will work (i guess). Why dont you try that?
 
It didn t work, and I know why and I can t explain to you sorry, but thanks anyways for the effort.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top