Should both of them reference the same object?
As far as I know, Both are same. For cross browser safety you can use window.location
rather than document.location
.
All modern browsers map document.location
to window.location
, but I still prefer window.location
as that's what I've used since I wrote my first web page. it is more consistent.
you can also see document.location === window.location
returns true
, which clarifies that both are same.