Download A Smarter Way to Learn JavaScript: The new approach that uses
Transcript
You can omit window. It's legal to use location.href, location.hostname, location.pathname, and location.hash. It's more common to include window. You can omit href when you're detecting the URL. It's legal to use window.location, or simply location. (See above.) Including href is preferred for esoteric reasons. You can use document.URL as an alternative to window.location.href There are two more ways to direct the browser to a url, alternatives to window.location.href. You'll learn how to use these in the next chapter. 248