zoukankan      html  css  js  c++  java
  • js 关闭浏览器

    使用js关闭浏览器,ios下的uc、360、qq有问题

        ```
        var u = navigator.userAgent
        var isiOS = !!u.match(/(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
        var isSafari = u.toLowerCase().indexOf('safari') != -1
        if(isiOS) {
            // ios的safari支持window.close,uc、360、qq浏览器不支持
            if(isSafari) {
                window.opener = null;
                window.open("","_self").close()
            }
            return
        }
        if (navigator.userAgent.indexOf("MSIE") > 0) { //close IE  
            if (u.indexOf("MSIE 6.0") > 0) {
                window.opener = null;
                window.close();
            } else {
                window.open('', '_top');
                window.top.close();
            }
        } else if (u.indexOf("Firefox") > 0) { //close firefox  
            window.location.href = 'about:blank';
        } else if (u.toLowerCase().indexOf("ucbrowser") > 0) {
            window.location.href = '';
            setTimeout(()=>{
                window.location.href = 'about:blank';
            },0)
        } else { //close chrome;It is effective when it is only one.  
            window.opener = null;
            window.open("","_self").close()
            window.location.href = 'about:blank';
        }
        ```
  • 相关阅读:
    LINUX下用PHPIZE安装PHP GD扩展
    LNMP下使用Phabricator(一)
    关于学习
    PHP EXCEL相关
    curl_setopt 注意
    JS代码运行延迟
    ajax跨域
    Bootstrap-下拉菜单
    Bootstrap-基本的按钮组
    Bootstrap-基本的输入框组
  • 原文地址:https://www.cnblogs.com/ethy/p/8028552.html
Copyright © 2011-2022 走看看