使用document.defaultView;

document.defaultView === window

 

注意: 

1. 如果当前文档不属于window对象, 则返回null;

2. document.defaulView 是 document 的快捷方式属性;

相关文章: