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

该网页是如何判断用户是否使用移动设备的?仅在开发者工具中使用 iPhone 用户代理,打开网页的结果不符合预期,必须在 devtools 中模拟移动设备才符合预期

  •  
  •   VisualStudioCode · 201 天前 · 662 次点击
    这是一个创建于 201 天前的主题,其中的信息可能已经有所发展或是发生改变。

    https://www.1point3acres.com/bbs/tag-9620-1.html

    在开发者工具中,启用模拟移动设备,进入该网页会跳转至该网页的移动版。

    然而,仅在 devtools 的「网络状况」中使用 iPhone 用户代理的话,进入该网页会跳转至另一个不符合预期的网页:

    https://www.1point3acres.com/bbs/forum.php?mobile=1

    备注:我使用的 iPhone 用户代理:

    Mozilla/5.0 (iPhone; CPU iPhone OS 17_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Mobile/15E148 Safari/604.1

    1 条回复    2023-11-01 17:31:16 +08:00
    Rache1
        1
    Rache1  
       201 天前   ❤️ 1
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2930 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 11:13 · PVG 19:13 · LAX 04:13 · JFK 07:13
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.