<script type="text/javascript"> // 对浏览器的UserAgent进行正则匹配,不含有微信独有标识的则为其他浏览器 var useragent = navigator.userAgent; if (useragent.match(/MicroMessenger/i) != ‘MicroMessenger‘) { // 这里警告框会阻塞当前页面继续加载 var url = window.location.href; window.location.href = ‘https://open.weixin.qq.com/connect/oauth2/authorize?appid={$_W[‘account‘][‘key‘]}&redirect_uri=‘+url+‘&response_type=code&scope=snsapi_base&state=YWN0PW1vZHVsZSZuYW1lPXNob3BwaW5nMiZkbz1saXN0JndlaWQ9Mg==&connect_redirect=1#wechat_redirect‘; } </script>