Click to See Complete Forum and Search --> : document.location...
AdamBrill
12-28-2002, 09:38 PM
I'm trying to change the document.location without reloading the page. Is there anyway to do that? Say it is http://www.somedomain.com and you want to change it to http://www.somedomain.com?test Is there some way to do that without reloading the page? Thanks.
Beach Bum
12-28-2002, 11:55 PM
I am confused. You want to change the page without changing the page?
Or do you mean you want to change the current page address in the browser history without changing the page that is currently being viewed?
Or something else?
Can you explain a little more about what you want to do?
Charles
12-29-2002, 05:14 AM
Originally posted by Dave Clark
window.top.location.search = "?test";The location property is a strange one. In JavaScript version 1.0 Document.location is a read only property that contains the URL of the current document. In JavaScript 1.1 Document.location was depricated in favour of Window.location.href. To keep things running, though, Document.location is now just a reference to the containing Window.location which is an object. See http://developer.netscape.com/docs/manuals/js/client/jsref/index.html for details concerning this object. And yes, the search property of this object is read/write.
You will note that I've written Document.location and Window.location instead of document.location and window.location. That's a common short hand for Document.prototype.location and Window.prototype.location. When I write Window I mean any window object. It could be window, top or even charles. The above example should have been written top.location.search = "?test";.