在FF地址栏里输入about:config
在配置列表中找到 dom.allow_scripts_to_close_windows
点右键的选切换把上面的false修改为true

chrome里是可以的,firefox在window.open的才能用window.close
<script type="text/javascript">
var cls=document.getElementById("yes");
cls.addEventListener("click",function(){
if (navigator.userAgent.indexOf("Firefox") > 0) { //ff打开一个空白页
window.location.href = 'about:blank ';
}else { //chrome关闭
window.opener = null;
window.open('', '_self', '');
window.close();
// window.history.go(-1);
}
});
</script>
浙公网安备 33010602011771号