Socket
Socket
Sign inDemoInstall

device-detectives

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    device-detectives

🚀 Uma extensão que detecta o dispositivo de usuário


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Device Detectives

npm version license

Device Detectives é uma biblioteca JavaScript simples e leve para detectar o tipo de dispositivo com base no User Agent.

Instalação

Para usar o Device Detectives em seu projeto, você precisa ter o Node.js e o npm instalados. Em seguida, basta executar o seguinte comando no terminal:

npm install device-detectives

Como usar

const detectarDispositivo = require('device-detectives');

const userAgentDesktop = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3';
const userAgentMobile = 'Mozilla/5.0 (Linux; Android 10; SM-G970U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Mobile Safari/537.36';
const userAgentTablet = 'Mozilla/5.0 (iPad; CPU OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1';

console.log(detectarDispositivo(userAgentDesktop)); // Output: desktop
console.log(detectarDispositivo(userAgentMobile)); // Output: mobile
console.log(detectarDispositivo(userAgentTablet)); // Output: tablet

Detalhes sobre a detecção

desktop: Dispositivos de mesa (computadores).
mobile: Dispositivos móveis, como smartphones.
tablet: Tablets.

Keywords

FAQs

Last updated on 20 Jul 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc