Morgan Cheng Morgan Cheng - 1 year ago 68
Javascript Question

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

Should both of them reference to same object?

Answer Source

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