要求帝国CMS做的网站只能在手机端微信浏览器打开,可以对公众号加关注这些,可以在前台JS静态判断客户端,操作步骤如下。
把以下js代码加到模板里头部
<script type="text/javascript">
if( typeof WeixinJSBridge!== "undefined" ) {}
else
{
if(screen.width>=1000){var opened = window.open('/wxError.html', '_self');}
else{}
}
</script>
然后在后台栏目-自定义页面-新建个自定义页面-命名为wxError.html
代码以下:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="width=device-width,inital-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport"/>
<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/open/libs/weui/0.4.1/weui.css">
</head>
<body>
<div class="weui_msg">
<div class="weui_icon_area"><i class="weui_icon_info weui_icon_msg"></i></div>
<div class="weui_text_area"><h4 class="weui_msg_title">请在微信客户端打开链接</h4></div></div>
</body>
</html>
本文摘自网络,不代表短经典网立场 https://www.duanjingdian.com/571.html