Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is there a way to detect iPhone model using js?

I need to detect the user’s iPhone model and if it’s lower than iPhone X (e.g. iPhone 8) – not to run some powerful logic (camera access and face masks via webGl), because weak devices can’t run it without crashing ((

So is there any way to identify the iPhone model using js?

I was searching for solution, find some API, but they cost money )

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

And saw how someone was using device height and width, but not sure if it works correctly

>Solution :

There is no baked in way to do that. There are way to do it but none are perfect and all have drawbacks

User-agents don’t give that information, but you can compare it’s string to known devices user-agent strings

Since you use react, this is what React-device-detect does.

another way like you said is to use the resolution and compare it to known devices resolution. You could take a look at that unmaintained library to get some ideas (you will need to expend their list since it’s 4 years old)

The best solution is probably a mix of those methods in order to target as accurately as possible the models you want.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading