I find myself always writing:
console.log(window.location.href);
without even thinking about it. The majority of answers on SO also write it this way. Is there any reason why I can't just write:
location.href
since location
is an object at window level? Are there any cross-browser compatibility issues with this?
To Clarify: I know there is document.location
- that is NOT what this question is about. This is about if there is any difference with using only location
vs using window.location
across browsers.
location
vslocation.href
, but aboutx
vswindow.x
– Pursuit