Marc Ster
Marc Ster

Reputation: 2316

How to detect tablet vs smartphone in javascript [Phonegap App]

I know there is the possibility to detect it with css queries but i don´t want to do that. I also don´t want to use the scree.size solution, because is is not accurate. I also tried userAgent, but i can´t distinguish between android tablet and android smartphone.. So how can i just check if it is a tablet (Android or iPad) or a Smartphone (iPhone or Android)

can´t find a proper solution.. thanks

Upvotes: 4

Views: 5473

Answers (1)

Zp1k_e
Zp1k_e

Reputation: 138

like Marc Ster said years ago, eg:

var isPhone = screen.height < 800 || screen.width < 800;

Upvotes: 2

Related Questions