File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Window.location.replace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Window.location.replace" Watch "Window.location.replace" New topic
Author

Window.location.replace

Vrunda Joshi
Ranch Hand

Joined: Dec 03, 2001
Posts: 104
hi,
in my application on click of a hyper-link,i am redirecting the page with window.location.replace("newURL").however this works fine with some versions of ie only.ie, it works with MSIE 5.5 but not with MSIE 5.0 is there any alternative to this.
thanks in advance
-vrunda
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Hmm, the O'Reily Javascript book (the rhino one) says IE5 runs JScript5 and IE5.5 runs JScript5.5, which should be equivelent to JavaScript 1.4 and that Location.replace() exists since JavaScript 1.1
Wierd
Have you tried window.location = "http://..."; instead?
Dave.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

whats even wierder is i am certain i used window.location.replace("new url") before i had IE5.5 and it worked. however i would try what david suggested. you really only need to use replace if you want to eliminate a page from window.history


SCJP
Visit my download page
Vrunda Joshi
Ranch Hand

Joined: Dec 03, 2001
Posts: 104
hi,
thanks for the reply,but i have tried the window.location="http://....",but no luck.
can anybody please guide me on these lines,
"you really only need to use replace if you want to eliminate a page from window.history"
can you make it clear a bit?
thanks in advance
-vrunda
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
What about window.navigate(URL)?
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

when you use window.location="http://....", and someone clicks the link, if they then hit the back button they return to the page they were on(the one that contains the link). with window.location.replace("new url"), if they click the link then hit back button they go not to the page they were on, but the one before the one they were on. replace means replace.
window.navigate(URL) is new to me.
what is the reason you need javascript? why not just use a plain html link?
[ May 07, 2002: Message edited by: Randall Twede ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

window.navigate() appears to be IE only. What version? Dunno. IE4+ I'm guessing.
vijaya bacina
Ranch Hand

Joined: Aug 23, 2005
Posts: 155
Thank you very much.
window.navigate() worked for me. I am looking for a method like this from 3 hours and finally found here.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Window.location.replace