1
greatdk 2015-02-28 19:20:46 +08:00 1
function is_weixin(){
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false ) { return true; } return false; } |
2
1dian01 OP @greatdk 找到这么一个html,微信可以打开提示信息,但是好像没有跳转,可否帮吗加一下,感谢!
<!DOCTYPE html> <html lang="zh_CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1" /> <script type="text/javascript" src="http://libs.useso.com/js/jquery/1.9.0/jquery.min.js"></script> <title>点击下载应用</title> <style type="text/css"> * { margin: 0; padding: 0; } a { text-decoration: none; } 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> </head> <body> <div class="weixin-tip"> <p> <img src="http://img.caibaojian.com/uploads/2014/10/weixin-tip.jpg" alt="点击右上角按钮,选择在浏览器中打开" /> </p> </div> <script type="text/javascript"> $(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(); } }) </script> </body> </html> |
3
codeface 2015-02-28 20:24:17 +08:00
根据user_agent可以来判断。
|
4
Tink 2015-02-28 20:47:34 +08:00
user agent
|