douxuan0698 2019-01-23 07:20
浏览 738

HTTP_USER_AGENT - 区分ipad和ipad pro

When I do var_dump(HTTP_USER_AGENT) on my google screen selecting the devices IPAD and IPAD PRO I get this:

Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1

Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1

Theres no difference between these two while the resolution is different for each. I need to load a file depending on if its ipad or its ipad pro.

How can I achieve this?

  • 写回答

1条回答 默认 最新

  • duandao8607 2019-01-23 07:51
    关注

    Well, you have to set different stylesheet rule for differentiating device sizes


    <html>
    <head>    
        <link rel="stylesheet" media="all and (max-device-width: 1668px) and (device-height: 2388px) and (orientation:portrait)" href="ipad-pro-portrait.css" />
        <link rel="stylesheet" media="all and (max-device-width: 1668px) and (device-height: 2388px) and (orientation:landscape)" href="ipad-pro-landscape.css" />
        <link rel="stylesheet" media="all and (device-width: 768px) and (device-height: 1024px) and (orientation:portrait)" href="ipad-portrait.css" />
        <link rel="stylesheet" media="all and (device-width: 768px) and (device-height: 1024px) and (orientation:landscape)" href="ipad-landscape.css" />
    
    </head>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 活动选择题。最多可以参加几个项目?
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
  • ¥50 NT4.0系统 STOP:0X0000007B
  • ¥15 想问一下stata17中这段代码哪里有问题呀
  • ¥15 flink cdc无法实时同步mysql数据