为防止出现问题,我在顶级范围内添加了此代码(意味着this==window
):
if(top!==this)top.location.search="?removeFrame"
这在IE以外的所有浏览器中都能很好地工作(在IE 8中失败,保持刷新,不确定它是否适用于更高版本),我认为这是因为IE甚至不考虑top==this
主窗口在顶部
如何重写此代码以使其与IE兼容?
答案 0 :(得分:3)
尝试改变:
if(top!==this)top.location.search="?removeFrame"
到
if(top!=this)top.location.search="?removeFrame"
根据this帖子,我们应该避免在比较窗口对象时使用严格的(===)
运算符