窗口之间有什么区别。Location和document。Location ?它们是否都引用同一个对象?
当前回答
文档。Location ===窗口。Location返回true
also
Document.location.constructor === window.location.constructor为true
注:仅在Firefox 3.6、Opera 10和IE6上测试
其他回答
是的,它们是一样的。这是浏览器JS API的众多历史怪癖之一。试着做:
window.location === document.location
文档。location最初是一个只读属性,尽管Gecko浏览器也允许你为它赋值。为了跨浏览器安全,请使用window。位置相反。
阅读更多:
document.location
window.location
实际上,我注意到两者之间的chrome的区别,例如,如果你想做一个导航到沙盒框架从一个子框架,那么你可以这样做,只是与文档。Location,但不是window。Location
文档。Location ===窗口。Location返回true
also
Document.location.constructor === window.location.constructor为true
注:仅在Firefox 3.6、Opera 10和IE6上测试
是的,他们是一样的,但是....!
窗口。location在某些Internet Explorer浏览器上无法工作。