Detect iPhone 3G or 3GS (and iPod touch 2G vs iPod touch 3G) in JavaScript

后端 未结 3 1661
醉梦人生
醉梦人生 2021-02-07 20:16

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

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

From the newer

3条回答
  •  醉梦人生
    2021-02-07 21:03

    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.

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

    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.

提交回复
热议问题