通过 Jquery / Javascript 检测 iPad 和 iPad2 之间?

发布于 2024-11-13 10:08:33 字数 78 浏览 4 评论 0原文

有没有办法通过 Jquery / Javascript 来检测 iPad 和 iPad2 之间的情况?或者甚至是 PHP 或网站上的其他方式?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

冷心人i 2024-11-20 10:08:33

我有一台 iPad 和一台 iPad2,它们的 iOS 版本相同,但我不认为这是目前可能的,它在两台设备上生成完全相同的用户代理。

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

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
莳間冲淡了誓言ζ 2024-11-20 10:08:33

javascript 用户代理 Mobile 字符串 (Mobile/9A405) 似乎依赖于 CPU 操作系统版本。因此,虽然某些地方可能因 iPad 一代而异,但通常是因为 CPU 操作系统版本不同。

示例 1 - 不同的 CPU 操作系统 = 不同的手机/字符串:

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

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

示例 2 - 相同的 CPU 操作系统 = 相同的手机/字符串:

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

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

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

凉城已无爱 2024-11-20 10:08:33

正如您在下面看到的,唯一的区别是 ipad:Mobile/8F190 ipad2:Mobile/8F191,因此可以砍掉用户代理并查找差异。

iPad 用户代理字符串:

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

iPad2 用户代理字符串:

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

但我非常怀疑那里safari 的版本之间有很大差异,也许你只是想通知用户,一个比另一个有更多的钱;p...

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...

往日情怀 2024-11-20 10:08:33

有一些重要的差异,比如相机。例如,我想检测用户在 ipad 上,甚至不显示相机按钮,但如果用户在 ipad2 上,我将显示相机图标,他们可以使用相机。

我现在能做的就是调用拍照方法,如果出现错误,则假设它是 ipad。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文