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 MATLAB动图问题
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名