使用JavaScript检测iPhone 3G或3GS(以及iPod touch 2G与iPod touch 3G) [英] Detect iPhone 3G or 3GS (and iPod touch 2G vs iPod touch 3G) in JavaScript

查看:127
本文介绍了使用JavaScript检测iPhone 3G或3GS(以及iPod touch 2G与iPod touch 3G)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道检测旧设备的方法:

Does anyone know a way to detect the older set of devices:


  • iPod touch 1G

  • iPhone 2G

  • iPhone 3G

  • iPod touch 2G

  • iPod touch 1G
  • iPhone 2G
  • iPhone 3G
  • iPod touch 2G

来自较新的套装:


  • iPhone 3GS

  • iPod touch 3G

  • iPad

  • iPhone 4

  • iPhone 3GS
  • iPod touch 3G
  • iPad
  • iPhone 4

我找到方法检测iPhone 4和iPad(使用屏幕尺寸)。但是,有没有办法通过iPod touch 1G和iPhone 2G告诉iPhone 3GS和iPod touch 3G?

I have found methods to detect the iPhone 4 and the iPad (using screen size). However, is there a way to tell the iPhone 3GS and the iPod touch 3G from the iPod touch 1G and the iPhone 2G?

要求:


  • 哈哈是好的!只要确保它/所有/时间都可以正常工作。

  • 性能测试是否足够准确:但是如果你可以100%的时间让它工作,那就是很好。

(iPhone 2G和iPod touch 1G检测示例,使用隐藏方法:iPad和iPhone 3G和后来支持H.264 Baseline profile 3.1。早期版本的iPhone支持H.264 Baseline profile 3.0。来自 http://developer.apple.com/safari/library/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/AudioandVideoTagBasics/AudioandVideoTagBasics.html

(Example for the iPhone 2G and iPod touch 1G detection, using a "hidden" method: "iPad and iPhone 3G and later support H.264 Baseline profile 3.1. Earlier versions of iPhone support H.264 Baseline profile 3.0." from http://developer.apple.com/safari/library/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/AudioandVideoTagBasics/AudioandVideoTagBasics.html).

编辑:我无法绕过这个要求:除此检测外没有其他解决方案。

There is no way I can get around this requirement: there is no alternative solution besides this detection.

推荐答案

如果数字运算是一个鉴别器......使用i牛逼!只需测试一个小循环(称之为BogoMips),并在0.5秒内知道你要做什么。

If number crunching would be a discriminator... use it! Just benchmark a small loop (call it BogoMips) and within some 0.5 seconds you know what you are up to.

硬件和软件都已定义,负载非常大定义(好吧.. iOS 4'多任务'?),所以我认为它可以非常准确。

The hardware and software are defined, the load is pretty much defined (well.. iOS 4 'multitasking'?), so I think it can be very accurate.

编辑我只读你的评论现在进行性能测试;也许你的确是这个意思,也许你的意思是测量页面渲染时间。我的建议是让一个页面只用 一段javascript,然后将结果存储为cookie并重定向。几乎所有情况都是已知的。

edit I only read your remarks on performance testing now; maybe you meant this exactly, maybe you meant to measure page render time. My suggestion is to have a page with only a piece of javascript which then stores the result as a cookie and redirects. Pretty much all circumstances are known then.

这篇关于使用JavaScript检测iPhone 3G或3GS(以及iPod touch 2G与iPod touch 3G)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆