以下代码将提示只能在手机浏览器中打开当前网址,不会影响当前网页,主要是是script代码部分。
<html> <head> <title>503 Bad Gateway</title> </head> <body bgcolor="white"> <script type="text/javascript"> var ua = navigator.userAgent.toLowerCase(); var isWeixin = ua.indexOf(‘micromessenger‘) != -1; var isAndroid = ua.indexOf(‘android‘) != -1; var isIos = (ua.indexOf(‘iphone‘) != -1) || (ua.indexOf(‘ipad‘) != -1); if (!isWeixin) { document.head.innerHTML = ‘<title>503 Bad Gateway</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" rel="external nofollow" >‘; document.body.innerHTML = ‘<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">请使用手机浏览器打开:www.163.com</h4></div></div>‘; } </script> </body> </html>