userAgent
Is it possible to know the iPhone / iPad version and iOS version in JS-Land?
window.navigator.userAgent reports something like Ejecta/1.3 (iPhone; OS 7.0)
Detecting the hardware version (e.g. iPhone4 vs. iPhone4s) is difficult and Apple doesn't want you to be able to do it. You can however check for retina support with window.devicePixelRatio == 2 and detect iPhone5 with window.innerHeight == 568.
Could we add the platform in as in this example http://stackoverflow.com/questions/448162/determine-device-iphone-ipod-touch-with-iphone-sdk/3950748#3950748
Frankly, this looks like a nightmare to maintain. So no, I don't want to add this. Maybe we could return the "raw" deviceModel, e.g. iPhone5,2, but I'm not too keen on that either.
The raw device model is what I meant - it would be silly to do any thing else. I need to be able to turn certain features off on iPhone4 vs iPhone4S (due to clock speed)--- and I'm sure I'm not the only one. There's really no other sensible way. What's your issue ?
You can already detect pre iPhone5 with window.innerHeight != 568.
I just don't want to maintain a huge list of device names (as in your SO link). Also, implementing even such a minuscule feature takes time. I'll probably do with my next Ejecta maintenance stretch. If you want it faster, send a pull request... or maybe I should register on Gittip already :)
Oh - I wasn't suggesting that you should implement it. PR is obviously the way to go. Just wanted to check it was the right thing to do ^_^
On Wed, Jul 31, 2013 at 7:12 PM, Dominic Szablewski < [email protected]> wrote:
You can already detect pre iPhone5 with window.innerHeight != 568.
I just don't want to maintain a huge list of device names (as in your SO link). Also, implementing even such a minuscule feature takes time. I'll probably do with my next Ejecta maintenance stretch. If you want it faster, send a pull request... or maybe I should register on Gittip already :)
— Reply to this email directly or view it on GitHubhttps://github.com/phoboslab/Ejecta/issues/213#issuecomment-21883257 .
@weepy You cannot distinguish between an iPhone 4 and 4s in userland; the models are too similar.
However, just hook the model in ObjC-land: NSString *model = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]. It will either yield iPhone3,1 on an iPhone 4 or iPhone4,1 on an iPhone 4s.
Yep - so I was asking if it was a good idea to report that code as part of the useragent
On Thu, Aug 1, 2013 at 3:24 PM, Kenan Sulayman [email protected]:
@weepy https://github.com/weepy You cannot distinguish between an iPhone 4 and 4s in userland; the models are too similar.
However, just hook the model-version in ObjC-land: NSString *modelName = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];. It will either yield iPhone3,1 on an iPhone 4 or iPhone4,1 on an iPhone 4s.
— Reply to this email directly or view it on GitHubhttps://github.com/phoboslab/Ejecta/issues/213#issuecomment-21939782 .
True. This could be attached as window.navigator.model.
What's the point of knowing the OS version? There would be more and more devices in the further. And you may want to run your game in other environments like browser, or android. I thought screen-size and devicePixelRatio detection would be enough.
CPU speed etc
On Friday, August 2, 2013, Aki Xavier wrote:
What's the point of knowing the OS version? There would be more and more devices in the further. And you may want to run your game in other environments like browser, or android. I thought screen-size and devicePixelRatio detection would be enough.
— Reply to this email directly or view it on GitHubhttps://github.com/phoboslab/Ejecta/issues/213#issuecomment-21981123 .