源码论坛,商业源码下载,尽在锦尚中国商业源码论坛
标题:
无痕自动关闭当前浏览器页面脚本代码,实测可用
[打印本页]
作者:
欧阳锋
时间:
2022-6-14 23:51
标题:
无痕自动关闭当前浏览器页面脚本代码,实测可用
找了好多JS脚本代码都无法实现无痕无提示自动关闭当前页面的脚本代码,这里给出直接可用代码,已经放置在实际开发项目中,非常不错!!!
<script>
if (navigator.userAgent.indexOf('MSIE') > 0) { // close IE
if (navigator.userAgent.indexOf('MSIE 6.0') > 0) {
window.opener = null;
window.close();
} else {
window.open('', '_top');
window.top.close();
}
} else { // close chrome;It is effective when it is only one.
window.opener = null;
window.open('', '_self');
window.close();
}
</script>
复制代码
欢迎光临 源码论坛,商业源码下载,尽在锦尚中国商业源码论坛 (https://bbs.52jscn.com/)
Powered by Discuz! X3.3