最近做项目的时候碰到一个问题:
在js里面使用window.close(),IE下工作正常,但是FireFox下有时可以,有时不行。</div>

搜索发现,可以这样解决:

Close Window
在前面加一句&nbsp; window.open(”,’_parent’,”);
作用为:
fool the browser into thinking that it was opened with a script

This opens a new page, (non-existent), into a target
frame/window, (_parent which of course is the window in
which the script is executed, so replacing itself),
and defines parameters such as window size etc, (in
this case none are defined as none are needed). Now
that the browser thinks a script opened a page we
can quickly close it in the standard way…

Leave a Reply

电子邮件地址不会被公开。 必填项已用*标注