微信公众号js限制页面只能在微信浏览器打开 禁止外置浏览器
<script>
var ua = navigator.userAgent.toLowerCase();
var isWeixin = ua.indexOf('micromessenger') != -1;
if (!isWeixin) {
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=888"
}
</script>
如果非微信浏览器打开,跳转页面如下: