Search

Mar 20, 2007

Playing with location of window in javascript

I found some properties and method which is really usefull while working with window location

· Properties

window.location.hashthe part of the URL that follows the # symbol.
window.location.hostthe host name and port number
window.location.hostnamethe host name (without the port number).
window.location.hrefThe entire URL
window.location.pathnameThe path (relative to the host).
window.location.portThe port number of the URL
window.location.protocolThe protocol of the URL
window.location.searchthe part of the URL that that follows the ? symbol


· Methods
assign(url)Load the document at the provided URL.
reload(forceget)Reload the document from the current URL. forceget is a boolean, which, when it is true, causes the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache.
replace(url)Replace the current document with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session history, meaning the user won't be able to use the Back button to navigate to it.
toString()
Returns the string representation of the Location object's URL. See the JavaScript
reference for details.


I have delicious on JavaScript

No comments: