I'm developing apps with Apache Cordova for iOS and would like to make them available on Macs with Apple Silicon, too.
Although I don't need it right now, I'd like to implement a method to distinguish between iPads running the app and Macs with Apple Silicon in my javascript code.
I came up with the idea of checking navigator.platform
(which is iPad
for both platforms) in connection with navigator.camera.Direction
. My assumption is that all relevant iPads have two cameras (front & back), while Macs should only report a front facing camera (if any). Ipads would report this:
{BACK: 1, FRONT: 1}
Macs would report either {BACK: 0, FRONT: 1}
or {BACK: 0, FRONT: 0}
(if no camera is available).
Do you think this will work? Am I overlooking something?