faisalman / ua-parser-js

"Unmask Your Traffic" - UAParser.js: The Essential Web Development Tool for User-Agent Detection
https://uaparser.dev/
GNU Affero General Public License v3.0
9.24k stars 1.19k forks source link

Can `desktop` be an option for `device.type`? #502

Closed bobsilverberg closed 2 years ago

bobsilverberg commented 3 years ago

I notice that device.type can be one of console, mobile, tablet, smarttv, wearable, embedded, but for a desktop browser it just returns undefined. Is there a reason that decision was made? Could device.type return desktop in cases where it is known to be a desktop browser?

The-Linguist commented 3 years ago

@bobsilverberg Thank you for opening the topic for discussion. As a single-page-app builder I always need to adjust my user interface design for three things:

Fine tuning a web app for these 3 main environments is a must. So far I have been using PoeHaH/devicedetector to do that. It works great. It has an isMobile feature that returns true for either tablet or phone which is useful as well in terms of being able to write self-explanatory code.

If ua-parser-js had the same functionality I wouldn't have to include yet another separate library and I could simplify my code.

ruohola commented 2 years ago

Was discussed here: https://github.com/faisalman/ua-parser-js/issues/182#issuecomment-263115448