源码论坛,商业源码下载,尽在锦尚中国商业源码论坛

标题: 无痕自动关闭当前浏览器页面脚本代码,实测可用 [打印本页]

作者: 欧阳锋    时间: 2022-6-14 23:51
标题: 无痕自动关闭当前浏览器页面脚本代码,实测可用
找了好多JS脚本代码都无法实现无痕无提示自动关闭当前页面的脚本代码,这里给出直接可用代码,已经放置在实际开发项目中,非常不错!!!

  1. <script>
  2. if (navigator.userAgent.indexOf('MSIE') > 0) { // close IE
  3.    if (navigator.userAgent.indexOf('MSIE 6.0') > 0) {
  4.       window.opener = null;
  5.       window.close();
  6.    } else {
  7.       window.open('', '_top');
  8.       window.top.close();
  9.    }
  10. } else { // close chrome;It is effective when it is only one.
  11.    window.opener = null;
  12.    window.open('', '_self');
  13.    window.close();
  14. }
  15. </script>
复制代码





欢迎光临 源码论坛,商业源码下载,尽在锦尚中国商业源码论坛 (https://bbs.52jscn.com/) Powered by Discuz! X3.3