Monday, December 5, 2005

Javascript Location Object

The Javascript location object has 3 important properties: href, host, and protocol and 2 methods: replace() and reload()

location.href - returns the current URL
location.host - returns the current Host
location.protocol - returns the protocol used
window.location.href = "http://www.newurl.com" - sends user to "http://www.newurl.com"
window.location.replace("http://www.newurl.com") - sends user to "http://www.newurl.com"
setTimeout("location.reload()",100000) - refreshes the current page every 100 seconds

No comments: