写脚本时不小心发现了一个新的不经过确认直接关闭IE窗口的方法不过还是ie-only.而且,此方法有个非常恐怖的地方,它不是单纯关闭窗口,而是关闭整个浏览器,ie7(无论多少实例),还有maxthon等都不能幸免于难.IE8会自动recover页面。
在我机子上是这样的, 别的机子就不得而知了,麻烦大家给看看, 是否通用.
偶然发现,但不明其理,麻烦高手解释下。
<script>
document.onclick = function() {
closeWin(event.srcElement);
}
function closeWin(o)
{
var aElm = document.createElement('a');
aElm.href = o.href;
var imgEml = document.createElement('img');
aElm.appendChild(imgEml);
document.body.appendChild(aElm);
aElm.click();
}
</script>
<input type="button" onclick="closeWin(this);return false;" value="关闭窗口">