zoukankan      html  css  js  c++  java
  • 判断UA这种事不能说的太明。

    【微博】 Mozilla/5.0 (Linux; U; Android 4.2.2; zh-cn; GT-I9502 Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

    【chrome】 Mozilla/5.0 (Linux; Android 4.2.2; GT-I9502 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.64 Mobile Safari/537.36

    【猎豹】 Mozilla/5.0 (Linux; Android 4.2.2; GT-I9502 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.64 Mobile Safari/537.36

    【海豚】 Mozilla/5.0 (Linux; U; Android 4.2.2; zh-cn; GT-I9502 Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

    【UC】 Mozilla/5.0 (Linux; U; Android 4.2.2; zh-CN; GT-I9502 Build/JDQ39) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 UCBrowser/9.4.2.365 U3/0.8.0 Mobile Safari/533.1

    【baidu】 Mozilla/5.0 (Linux; U; Android 4.2.2; zh-cn; GT-I9502 Build/JDQ39) AppleWebKit/534.24 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.24 T5/2.0 baidubrowser/4.2.13.3 (Baidu; P1 4.2.2)

    【QQ】 MQQBrowser

    【搜狗】 SogouMSE, SogouMobileBrowser

    【小米】 XiaoMi/MiuiBrowser

    【遨游】 Maxthon

    【欧朋】 Opera, Oupeng

    --------------------------------------

    /* function check_useragent(){  var bool_result='success';  var pattern=/micromessenger|360browser|360|MQBrowser/(.*?)s+(iPhone;|Mozilla/(.*?)s+(iPhone;|sina_weibo/i;  var useragent='<?php echo strtoupper($_SERVER['HTTP_USER_AGENT']);?>';  var referer = '<?php echo strtoupper($_SERVER['HTTP_REFERER'])?>';  if(useragent.indexOf(('360ee').toUpperCase()) != -1 || useragent.indexOf(('360se').toUpperCase()) != -1) {  // location.href= "http://pc.huochepiao.360.cn";   return;  }  if(!useragent.match(pattern)){   bool_result=useragent.indexOf(('Android').toUpperCase())==-1?'failed_pc':'failed_mb';  }  return bool_result;  } <?php if(@$_SERVER['SERVER_NAME']!='10.16.15.227'&&@$_SERVER['SERVER_NAME']!='12306.com'){?>  var sta=check_useragent();  if(sta=='failed_pc'){   if(navigator.userAgent.indexOf('iPhone')>-1){    location.href='error.html?pc';   }else{    location.href='errorpc.html';   }  }  else if(sta=='failed_mb'){   if(referer.indexOf('weibo.cn') > -1) {   if(navigator.userAgent.indexOf('MQQBrowser')>-1 || navigator.userAgent.indexOf('SogouMSE')>-1 || navigator.userAgent.indexOf('SogouMobileBrowser')>-1 || navigator.userAgent.indexOf('XiaoMi')>-1 || navigator.userAgent.indexOf('MiuiBrowser')>-1 || navigator.userAgent.indexOf('Maxthon')>-1 || navigator.userAgent.indexOf('Opera')>-1 || navigator.userAgent.indexOf('Oupeng')>-1  || navigator.userAgent.indexOf('UCBrowser')>-1){    location.href='error.html?mb';   }   } else {    location.href='error.html?mb';   }  } <?php }?>  */

  • 相关阅读:
    java单例设计模式
    java实现直接排序冒泡排序二分查找数组反转
    使用LinkedList模拟洗牌功能
    使用LinkedList实现堆栈和队列数据结构存储方式
    Jdeveloper运行缓慢或启动报错【Unable to create an instance of the Java Virtual Machine】解决方法
    java线程——守护线程
    OAF常用配置文件(Profile)
    pl/sql动态根据cursor插入数据(含'&等特殊字符)
    java多线程介绍(二)
    eclipse 3.6 + tomcat 6.0 开发SSH框架学习
  • 原文地址:https://www.cnblogs.com/bugluo/p/3522573.html
Copyright © 2011-2022 走看看