有时候我们需要帝国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>