javascript-window.location或document.location
window对象的location属性与document对象的location属性之间是否存在差异javascript-window.location或document.location,javascript,object,browser,Javascript,Object,Browser,window对象的location属性与document对象的location属性之间是否存在差异 window.location || document.location // That is the question. 它们的属性相同吗 他们有不同的浏览器支持吗 这两个对象是相同的: console.log(window.location === document.location) // true 它们都指向位置对象 window.location represent positi
window.location || document.location // That is the question.
- 它们的属性相同吗
- 他们有不同的浏览器支持吗
- 这两个对象是相同的:
console.log(window.location === document.location) // true
它们都指向位置对象
window.location represent position in current view of page in browser window
和document.location
表示当前显示完整文档/页面的位置
e、 g在upto DAILY NEWS部分是
窗口
,整个页面向下滚动到最后是文档
为什么有两种方式访问同一对象?@adeneo感谢您的链接。他很有洞察力。投票结束我的问题。