7

I am developing a website for Apple i* devices which uses HTML5 webkit features like transitions but I want to disable some of the fancy stuff for older/slower iPhone models like iPhone < 3GS and iPod touch < 3rd Gen because on those devices the transitions are too slow.

Is there a way to detect the exact model (not just the OS/User Agent) within Javascript?

Thomas Rauscher
  • 403
  • 4
  • 13
  • 1
    Great first question. Welcome to Stack Overflow! – Paul D. Waite Jun 22 '10 at 15:48
  • possible duplicate of [What is the best way to detect a handheld device in jQuery?](http://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-handheld-device-in-jquery) – Neolisk Apr 04 '14 at 19:53

1 Answers1

3

This appears to work, at least to determine between 2 and 3g and 3gs... Don't know how to figure out if it is a 4g yet...

var percentmobile_t = new Date().getTime();
var percentmobile_s = 0;
while(new Date().getTime() - percentmobile_t < 20)
{
    Math.random();
    percentmobile_s++;
}
_is2_or_3g = (percentmobile_s < 1000);
Kris Erickson
  • 32,405
  • 26
  • 113
  • 170
  • While this can't pull out iPhone 4, it is an example of a way to do a sort of hidden benchmark to find out if the 3GS performance threshold is met - meets the needs it seems. – chucknelson Jun 29 '10 at 12:45