需求

微信扫码下载,倘若是微信或qq内置浏览器打开,提示用本机内置浏览器打开

解决方法

 // 是微信内部webView
        if (is_weixn()) {
            alert("请点击右上角按钮, 点击使用浏览器打开");
        }

        if(is_qq()){
          alert("请点击右上角按钮, 点击使用浏览器打开");
        }
        // 是微信浏览器
        function is_weixn() {
            var ua = navigator.userAgent.toLowerCase();
            if (ua.match(/MicroMessenger/i) == "micromessenger") {
                return true;
            } else {
                return false;
            }
        }
        function is_qq(){
          var sUserAgent =navigator.userAgent.toLowerCase();
          if( sUserAgent.match(/QQ/i) == 'qq'){
            return true
          }else{
            return false
          }
        }

相关文章:

  • 2021-06-28
  • 2022-01-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
  • 2021-12-17
相关资源
相似解决方案