Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 69
    While implementing a complex PayPal integration, I encountered a very compelling reason to use window.location: it does not require SAME ORIGIN. Commented Jul 4, 2014 at 13:55
  • 5
    Maybe it's just me but location = 'http://www.example.com' seems super readable. Albeit, as a special case. That is backwards compatible and will remain compatible in the foreseeable future.
    – Alex W
    Commented Apr 29, 2015 at 15:37
  • 12
    If window.location were an object, assigning a string to it would overwrite it with a string. In fact window.location is a property which has getter and setter methods. When you set it, a string is expected and the global Location object is updated by the setter. When you get it, the global Location object is returned.
    – JukkaP
    Commented Apr 22, 2016 at 7:08