美文网首页
微信提示用户使用浏览器打开新的页面

微信提示用户使用浏览器打开新的页面

作者: tenro | 来源:发表于2020-05-27 14:34 被阅读0次
//判断是不是在微信程序内
is_weixin() {
   var ua = navigator.userAgent.toLowerCase();
   if (ua.match(/MicroMessenger/i) == "micromessenger") {
      return true;
   } else {
      return false;
      }
}

//如果是微信程序就显示提示让用户打开手机默认浏览器,否则就直接跳转第三方页面
if (is_weixin()) {
    alert('请通过浏览器打开该页面')
} else {
    window.location.href = '你需要跳转的页面'
}

相关文章

网友评论

      本文标题:微信提示用户使用浏览器打开新的页面

      本文链接:https://www.haomeiwen.com/subject/tpywahtx.html