JavaScript: Setting location.href versus location
javascript
Solution
You might set `location` directly because it's slightly shorter. If you're trying to be terse, you can usually omit the `window.` too.
URL assignments to both `location.href` and `location` are defined to work in JavaScript 1.0, back in Netscape 2, and have been implemented in every browser since. So take your pick and use whichever you find clearest.
Problem
When would you set `location` to a URL string versus setting `location.href`? ``` location = "http://www.stackoverflow.com"; ``` vs ``` location.href = "http://www.stackoverflow.com"; ``` Mozilla Developer Network Reference