V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ithelloworld
V2EX  ›  程序员

开发时如何设置各种平台user-agent版本?

  •  
  •   ithelloworld · 2013-06-04 11:40:28 +08:00 · 3787 次点击
    这是一个创建于 3972 天前的主题,其中的信息可能已经有所发展或是发生改变。
    开发手机网站,支持iOS/Android,安装什么样的插件能看到如下版本的效果呢?

    平台: iPod touch(第5代)/iOS 6.1.2
    平台:SO-02C/OS:android 4.03
    平台:LT28h/OS:android 4.04

    在safari,chrome和firefox上试了一下相关插件,版本都不是很高。
    6 条回复    1970-01-01 08:00:00 +08:00
    gavingeng
        1
    gavingeng  
       2013-06-04 12:10:00 +08:00   ❤️ 1
    打开chrome的debug调试,点右下角的齿轮,打开后,你会看到 User-Agent的各种设置.
    dorentus
        2
    dorentus  
       2013-06-04 12:20:39 +08:00   ❤️ 1
    比较新版的 Chrome,打开『审查元素』的控制台,右下角有个小齿轮,点开之后可以设置 UA、屏幕大小等等信息
    ithelloworld
        3
    ithelloworld  
    OP
       2013-06-04 13:42:17 +08:00
    @gavingeng
    @dorentus
    谢谢二位回答。
    虽然能找到一些选项,可没有iOS 6的呀。
    ushuz
        4
    ushuz  
       2013-06-04 13:44:51 +08:00   ❤️ 1
    @ithelloworld 选other,把ios 6的UA填进去。ios 6的UA问谷歌或者自己找台设备试一下。
    ithelloworld
        5
    ithelloworld  
    OP
       2013-06-04 14:05:39 +08:00
    @ushuz Thanks.

    iPhone :

    Mozilla/5.0 ( iPhone ; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25

    iPad :

    Mozilla/5.0 ( iPad ; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25

    Reference:

    http://stackoverflow.com/questions/12305566/what-is-the-ios-6-user-agent-string
    dorentus
        6
    dorentus  
       2013-06-04 14:11:37 +08:00
    其实如果你的服务器端并没有针对不同的 UA 输出不同的页面的话,改 UA 测试意义不大(Chrome 那种设置 Device metrics 的方式倒是有些用处)。

    实在没有设备拿来测试的话,你可以在 OS X 上面装 Xcode,然后用它的 iOS 模拟器来看……
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   903 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 20:54 · PVG 04:54 · LAX 13:54 · JFK 16:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.