• 用户代理


    这里引用http://www.useragentstring.com/ 的用户代理报告来解释一下用户代理中的字段都是表示什么意思:

    chrome:

    Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36

    firefox:

    Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0

    IE:

    Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Geck

    移动端的代理检测:

    safari

    userAgent:Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B440 Safari/600.1.4

    android浏览器

    android系统中几乎全部杂牌国产浏览器都是使用的webkit的内核,opera在新版本上也从pesto转向webkit,截取一二示意:
    1、chrome(android版)
    Mozilla/5.0 (Linux; Android 4.1.1; MI 2 Build/JRO03L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36

    小米内置

    Mozilla/5.0 (Linux; U; Android 4.1.1; zh-cn; MI 2S Build/JRO03L) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36 XiaoMi/MiuiBrowser/2.1.1

    3、mercury浏览器:
    Mozilla/5.0 (Linux; U; Android 4.1.1; zh-cn; MI 2S Build/JRO03L) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

    4、opera浏览器
    旧版:
    Opera/9.80 (Android; Opera Mini/7.8.35885/35.5464; U; zh) Presto/2.8.119 Version/11.10

    新版:
    Mozilla/5.0 (Linux; U; Android 4.1.1; zh-CN; MI 2S Build/JRO03L) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 OPR/10.2.5.89953 Mobile Safari/534.30

    windows phone:

    自带IE11:

    Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Nokia 520) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537

    UC:

    Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Nokia 520) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537 UCBrowser/4.2.1.541 Mobile

    summary:

    关于用户代理更多的信息,可以查看http://useragentstring.com/pages/useragentstring.php

    代理检测(参考zmobile.js):

    1. var ua = function ( ua, appVersion, platform ) {
    2. return {
    3. // win系列
    4. win32 : platform === "Win32",
    5. ie : /MSIE ([^;]+)/.test( ua ),
    6. ieMobile : window.navigator.msPointerEnabled,
    7. ieVersion : Math.floor( (/MSIE ([^;]+)/.exec( ua ) || [0, "0"])[1] ),
    8. // ios系列
    9. ios : (/iphone|ipad/gi).test( appVersion ),
    10. iphone : (/iphone/gi).test( appVersion ),
    11. ipad : (/ipad/gi).test( appVersion ),
    12. iosVersion : parseFloat( ('' + (/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec( ua ) || [0, ''])[1])
    13. .replace( 'undefined', '3_2' ).replace( '_', '.' ).replace( '_', '' ) ) || false,
    14. safari : /Version//gi.test( appVersion ) && /Safari/gi.test( appVersion ),
    15. uiWebView : /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test( ua ),
    16. // 安卓系列
    17. android : (/android/gi).test( appVersion ),
    18. androidVersion : parseFloat( "" + (/android ([0-9.]*)/i.exec( ua ) || [0, ''])[1] ),
    19. // chrome
    20. chrome : /Chrome/gi.test( ua ),
    21. chromeVersion : parseInt( ( /Chrome/([0-9]*)/gi.exec( ua ) || [0, 0] )[1], 10 ),
    22. // 内核
    23. webkit : /AppleWebKit/.test( appVersion ),
    24. // 其他浏览器
    25. uc : appVersion.indexOf( "UCBrowser" ) !== -1,
    26. Browser : / Browser/gi.test( appVersion ),
    27. MiuiBrowser : /MiuiBrowser/gi.test( appVersion ),
    28. // 微信
    29. MicroMessenger : ua.toLowerCase().match( /MicroMessenger/i ) == "micromessenger",
    30. // 其他
    31. canTouch : "ontouchstart" in document
    32. };
    33. }( navigator.userAgent, navigator.appVersion, navigator.platform );




  • 相关阅读:
    C#正则表达式判断输入日期格式是否正确
    Linq 总结
    sql存储过程
    uploadify多文件上传实例--C#
    Get W3WP List when Debugging
    SharePoint 2010 BI:Chart Web Part
    Versioning SharePoint 2010 Workflow In VS
    Multilingual User Interface (MUI) In SharePoint 2013
    Create Custom Modification Form In VS 2012-Part1
    Create Custom Modification Form In VS 2012-Part2
  • 原文地址:https://www.cnblogs.com/rubyisaPM/p/4380065.html
Copyright © 2020-2023  润新知