window.location vs window.location.href
What are the difference between the window.location and window.location.href?
When to use the one not the other?
window.location is an object, it has several properties-
host,protocol,pathname,hash,search and href
and reload and replace methods.
window.location.href is the string value of the URL.
Use location when you want the object, href when you want the string.
the toString() method of the location object returns the location.href value,
so using location where it expects a string will convert it to a string.
Last edited by mrhoo; 05-22-2007 at 05:42 PM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)