原生js关闭窗口


if (navigator.userAgent.indexOf("MSIE") > 0) {
                        if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
                              window.opener = null;
                              window.close();
                        } else {
                              window.open('', '_top');
                              window.top.close();
                        }
                  } else if (navigator.userAgent.indexOf("Firefox") > 0) {
                        window.location.href = 'about:blank ';
                  } else {
                        window.opener = null;
                        window.open('', '_self', '');
                        window.close();
                  }

posted @ 2019-01-03 12:10  sfornt  阅读(526)  评论(0编辑  收藏  举报