解决微信公众号iOS分享失败

版权声明:转载请@我原创地址 https://blog.csdn.net/weixin_39706415/article/details/89156628

公众号分享的问题真多

url使用下面方式获取需要使用encodeURIComponent转换

        let url1 = encodeURIComponent(window.location.href.split('#')[0]);

 附上校验微信和ios的处理方式

let ua = navigator.userAgent.toLowerCase();
      let isWeixin = ua.indexOf('micromessenger') !== -1;
      let url1;
      if (isWeixin) {
        let isiOS = !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
        if (isiOS) {
          
        } else {
         
        }
}

猜你喜欢

转载自blog.csdn.net/weixin_39706415/article/details/89156628