在 JavaScript 中,如何判断我运行的是 iPad1 还是 iPad2?
如果 navigator.useragent 处于相同的 IOS 版本,则返回相同的结果。
用户代理是相同的,所以不起作用(我有 Ipad1 和 Ipad2,所以我知道是这种情况)。
我需要知道,因为 Ipad1 的可用内存小于 Ipad2,而且我需要在 Ipad1 上进行更少的预缓冲,否则会崩溃。
谢谢,
the navigator.useragent comes back the same if they are at the same IOS version.
The useragent is the same so that does not work (I have both an Ipad1 and Ipad2 so I know that is the case).
I need to know because the memory available to an Ipad1 is less than an Ipad2 and I need to do less prebuffering on an Ipad1 or I get crashes.
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
iPad1 没有陀螺仪,而 iPad2 有,检查 deviceOrientation 事件并查看它是否返回任何值,如果返回则您在 iPad2 中,否则您在 iPad1 中。
The iPad1 has no gyroscope and the iPad2 has, check for deviceOrientation events and see if it returns you any value, if it does then you are in iPad2 else you are in iPad1.
您可以使用用户代理字符串,但我认为这没有帮助,因为您可以从用户代理获得的唯一信息是操作系统版本和浏览器类型和浏览器类型。版本。喜欢:
You can use the User Agent string but i don't think it will help because the only info you can get from the user agent is the OS Version and the Browser type & version. like:
我不知道有什么方法可以从用户代理中识别 iPad 的版本。另外,我很好奇为什么要区分 iPad1 和 2?
不过,您可以从中识别 iOS 版本。以下是 iPad1 和 2 的示例用户代理。
iPad 1 UA:
iPad 2 UA:
I don't know any way of identifing the version of iPad from the User Agent. Also, I am curious why would you want to differentiate between iPad1 and 2?
You can however, identify the iOS version from it. Here are sample User-Agents for iPad1 and 2.
iPad 1 UA:
iPad 2 UA: