0

Is there any difference between the location property of the window object versus the location property of the document object?

window.location || document.location  // That is the question.
  • Are their properties identical?
  • Do they have differing browser support?
ѕтƒ
  • 3,547
  • 10
  • 47
  • 78
Web_Designer
  • 72,308
  • 93
  • 206
  • 262
  • @adeneo Thanks for the link. [@Christoph's answer](http://stackoverflow.com/a/2431375/552067) was insightful. Voted to close my question. – Web_Designer Feb 26 '13 at 07:58

2 Answers2

0

These two objects are identical:

console.log(window.location === document.location) // true

They both refer to Location object.

dfsq
  • 191,768
  • 25
  • 236
  • 258
-1
window.location represent position in current view of page in browser window

and document.location represents position in currently displaying full document/page

e.g in http://www.nationalgeographic.com/ upto DAILY NEWS section is window and full page scrolled down till end is document

Rizstien
  • 802
  • 1
  • 8
  • 23