在页面中添加如下代码,检测如果是微信打开的网页,则要求用户打开其他浏览器
div元素

<div class="weixin-tip">
<p>
<img src="/images/live_weixin.png" alt="在浏览器打开" />
</p>
</div>

sciprt代码:

    $(window).on("load", function () {
        var winHeight = $(window).height();
        function is_weixin() {
            var ua = navigator.userAgent.toLowerCase();
            if (ua.match(/MicroMessenger/i) == "micromessenger") {
                return true;
            } else {
                return false;
            }
        }
        var isWeixin = is_weixin();
        if (isWeixin) {
            $(".weixin-tip").css("height", winHeight);
            $(".weixin-tip").show();
        }
    })

样式代码:

<style type="text/css">
.weixin-tip a {
text-decoration: none;
}

.weixin-tip img {
max-width: 100%;
height: auto;
}

.weixin-tip {
display: none;
position: fixed;
left: 0;
top: 0;
bottom: 0;
background: rgba(0,0,0,0.8);
filter: alpha(opacity=80);
height: 100%;
width: 100%;
z-index: 100;
}

.weixin-tip p {
text-align: center;
margin-top: 10%;
padding: 0 5%;
}
</style>