Morgan Cheng Morgan Cheng - 7 months ago 14
Javascript Question

What's the difference between window.location and document.location in JavaScript?

Should both of them reference to same object?

Answer

According to the W3C, they are the same. In reality, for cross browser safety, you should use window.location rather than document.location.

See: http://www.w3.org/TR/html/browsers.html#dom-location