Detect between the iPad and iPad2 via Jquery / Jav

2019-05-13 12:12发布

Is there anyway to detect between the iPad and iPad2 via Jquery / Javascript? Or even PHP or some other way from a website?

4条回答
唯我独甜
2楼-- · 2019-05-13 12:26

I have an iPad and an iPad2 with the same iOS version and i don't this this is currently possible it's producing the same exact user agent on both devices.

iPad

Mozilla/5.0 (iPad; CPU OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3

iPad2

Mozilla/5.0 (iPad; CPU OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3
查看更多
我只想做你的唯一
3楼-- · 2019-05-13 12:34

There are differences which are important, like the camera. For instance I would like to detect a user is on an ipad and not even present the camera button, but if a user is on an ipad2 I will show the camera icon and they can use the camera.

All I can do right now is to call the method to take a picture and if I get an error assume it is an ipad.

查看更多
4楼-- · 2019-05-13 12:36

The javascript user agent Mobile string (Mobile/9A405) seems to be dependent on the CPU OS version. So, while some places it may differ by iPad generation, it's often because the CPU OS version is different.

EXAMPLE 1 - different CPU OS = different Mobile/string:

  • iPad 1 - Mozilla/5.0 (iPad; CPU OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48:3

  • iPad 2 - Mozilla/5.0 (iPad; CPU OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B176 Safari/7534.48:3

EXAMPLE 2 - same CPU OS = same Mobile/string:

  • iPad 1 - Mozilla/5.0 (iPad; CPU OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3

  • iPad 2 - Mozilla/5.0 (iPad; CPU OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3

查看更多
爱情/是我丢掉的垃圾
5楼-- · 2019-05-13 12:47

As you can see below the only difference is ipad:Mobile/8F190 ipad2:Mobile/8F191 so it is possible to chop down the user agent and look for the difference.

The iPad user agent string:

Mozilla/5.0 (iPad; U; CPU OS 4_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F190 Safari/6533.18.5

The iPad2 user agent string:

Mozilla/5.0 (iPad; U; CPU OS 4_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F191 Safari/6533.18.5

but i very much doubt there is much difference between the versions of safari, perhaps your just looking to notify the user, that one has more money then the other ;p...

查看更多
登录 后发表回答