可爱熊个人博客

判断页面必须在微信中打开

<html>
<head>
<meta charset=”utf-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1, user-scalable=0″>
<script src=”https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js”></script>
</head>
<body>
<script type=”text/javascript”>
$(function(){
var ua = navigator.userAgent.toLowerCase();
var isWeixin = ua.indexOf(‘micromessenger’) != -1;
if (!isWeixin) {
document.head.innerHTML =
‘<title>抱歉,出错了</title><meta charset=”utf-8″><meta name=”viewport” content=”width=device-width, initial-scale=1, user-scalable=0″><link rel=”stylesheet” type=”text/css” href=”https://res.wx.qq.com/connect/zh_CN/htmledition/style/wap_err1a9853.css”>’;
document.body.innerHTML =
‘<div class=”page_msg”><div class=”inner”><span class=”msg_icon_wrp”><i class=”icon80_smile”></i></span><div class=”msg_content”><h4>请在微信客户端打开链接</h4></div></div></div>’;
}
})
</script>
</body>
</html>

Comments are closed.