Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

116
Vistas
JavaScript detect mobile device type with UserAgentData API

I'm using UserAgentData browser API to detect whether user has visited my page from mobile device or not. In browsers which supports it, it is quite simple and works well:

const isMobile = window.navigator.userAgentData?.mobile

Problem is that if device is mobile I want to also detect its type, whether it is phone or tablet. I do not want to parse navigator.userAgent string (or use existing libraries which do the same thing). I also do not want to look at device screen width/height and orientation, as as I understand device pixel density can be misleading here. So I'm using high entropy data from userAgentData API to obtain device model:

const detailedUserAgentData = await window.navigator.userAgentData?.getHighEntropyValues(['model']);

Here I have device model name, but still don't know what to do with it - is there any publicly available, open source, regularly updated data base from which I could obtain device type just by its name?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda