Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Joncom

Not really needing help per se. But while glancing through impact.js, noticed this code starting at line 381:

ig.ua.iPhone = /iPhone/i.test(navigator.userAgent);
ig.ua.iPhone4 = (ig.ua.iPhone && ig.ua.pixelRatio == 2);
ig.ua.iPad = /iPad/i.test(navigator.userAgent);
ig.ua.android = /android/i.test(navigator.userAgent);
ig.ua.iOS = ig.ua.iPhone || ig.ua.iPad;
ig.ua.mobile = ig.ua.iOS || ig.ua.android;

And I wonder if the one line shouldn't read like this:

// Added: ig.ua.iPhone4
ig.ua.iOS = ig.ua.iPhone || ig.ua.iPhone4 || ig.ua.iPad;

Haven&039;t tested this, because I don't have an iPhone 4, but by reading the code, it seems that iPhone 4 users would not be detected if checking with #ig.ua.mobile.

1 decade ago by lTyl

You are right about ig.ua.iOS. If you want to do something specific based on the iOS version, Impact won&039;t detect iPhone4, it will just return #ig.ua.iPhone for iPhone4 devices.

1 decade ago by Joncom

My bad. Misunderstood what it was doing. Looks like iPhone 4 still falls under `ig.ua.iOS` as well as `ig.ua.mobile`. The purpose of `ig.ua.iPhone4` just seems to be to detect the retina display.
Page 1 of 1
« first « previous next › last »