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,487
  • 10
  • 43
  • 77
Web_Designer
  • 68,768
  • 89
  • 200
  • 259
  • @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
  • 187,712
  • 24
  • 229
  • 250
-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