0

window 对象的 location 属性与 document 对象的 location 属性之间有什么区别吗?

window.location || document.location  // That is the question.
  • 它们的属性是否相同?
  • 他们有不同的浏览器支持吗?
4

2 回答 2

0

这两个对象是相同的:

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

它们都引用 Location 对象。

于 2013-02-26T07:51:17.557 回答
-1
window.location represent position in current view of page in browser window

document.location表示当前显示完整文档/页面中的位置

例如在http://www.nationalgeographic.com/ upto Daily NEWS 部分是window,整页向下滚动到最后是document

于 2013-02-26T07:56:09.303 回答