<script type="text/javascript" language="javascript">
function fc(){
var browserName=navigator.appName;
if (browserName=="Netscape"){
window.open('','_parent','');
window.close();
} else if(browserName=="Microsoft Internet Explorer") {
window.opener = "whocares";
window.close();
}
}
</script>
</head>
<body>
<div style="padding:100px;text-align:center">
<a href="javascript:fc()">关闭</a>
</div>
</body>
已经测试通过,兼容 IE ,谷歌 ,火狐中需要配置:
1、在地址栏输入about:config然后回车,警告确认
2、在过滤器中输入”dom.allow_scripts_to_close_windows“,双击即可将此值设为true