ua-parser-js
ua-parser-js copied to clipboard
Can `desktop` be an option for `device.type`?
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?
@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:
- Desktops (all fit-in-bag Laptop/Notebook types and no-carry office-desk Case&Cables types)
- Tablets
- Phones
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.
Was discussed here: https://github.com/faisalman/ua-parser-js/issues/182#issuecomment-263115448