- <title>Insert title here</title>
- <script type="text/javascript">
- window.onload=function(){
- var navi=navigator.userAgent;
- alert(navi);
- //实际上是 在浏览器下载
- if((navi.indexOf("Android")>=0) || (navi.indexOf("Linux")>=0)){
- if((navi.indexOf("MQQBrowser")>=0)|| (navi.indexOf("MicroMessenger")>=0) ){
- //微信扫描或者 QQ浏览器
- //window.location.href="http://m.meilishuo.com/download/latest/qrcode";
- window.location.href="http://wx.blinq.cn/cptest/opencard/firstandroid.apk";
- }else{
- //其他浏览器UC或者猎豹
- window.location.href="http://wx.blinq.cn/cptest/opencard/firstandroid.apk";
- }
- }else if(navi.indexOf("iPhone")>0 ||(navi.indexOf("iPad")>0) ||(navi.indexOf("Mac os")>0)){
- //不管是微信还是浏览器都要跳转 到 iTunes 授权后下载
- if((navi.indexOf("MQQBrowser")>=0)|| (navi.indexOf("MicroMessenger")>=0) ){
- window.location.href="https://itunes.apple.com/cn/app/bin-ke/id913944383?mt=8";//http://store.apple.com/cn
- }else{
- //另外一个立即下载的页面,
- window.location.href="http://m.meilishuo.com/download/latest/qrcode";
- //然后自动跳转到 APP Store
- }
- }else if(navi.indexOf("Windows Phone")>=0){
- window.location.href="http://windows.microsoft.com/zh-cn/windows/home";
- }else{
- window.location.href="http://www.baidu.com/";
- }
- }
- </script>
- ------------------------------------------------------------------------------------
- PHP 后台代码判断
- ====================================================================================
- $navi = getenv(HTTP_USER_AGENT);
- /*
- if((strpos($navi,"Android")>0) || (strpos($navi,"Linux")>0)){
- if((strpos($navi,"MicroMessenger")>=0)){
- $url= "http://m.meilishuo.com/download/latest/qrcode";
- echo $this->assign('url', $url)->fetch('redirect');
- return;
- }else{
- $url = "http://wx.blinq.cn/cptest/opencard/firstandroid.apk"; ///UC Broswer
- echo $this->assign('url', $url)->fetch('redirect');
- return;
- }
- }else if((strpos($navi,"iPhone")>0) || (strpos($navi,"Mac os")>0)){
- $url = "https://itunes.apple.com/cn/app/bin-ke/id913944383?mt=8";//http://store.apple.com/cn
- echo $this->assign('url', $url)->fetch('redirect');//出现到 微信重复加载redirect页面
- return;
- }else if(strpos($navi,"Windows Phone")>0){
- $url ="http://windows.microsoft.com/zh-cn/windows/home";
- echo $this->assign('url', $url)->fetch('redirect');
- return;
- }else{
- $url ="http://www.baidu.com/";
- echo $this->assign('url', $url)->fetch('redirect');
- return;
- }
- */
- //该片段来自于http://www.codesnippet.cn/detail/1612201411256.html
来源: http://www.codesnippet.cn/detail/1612201411256.html