Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

device-detector-js

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

device-detector-js

A javascript port of Matomo device-detector

  • 3.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
152K
increased by154.96%
Maintainers
1
Weekly downloads
 
Created

What is device-detector-js?

The device-detector-js npm package is a JavaScript library used to detect device types, operating systems, browsers, and other relevant information from user-agent strings. It is useful for tailoring user experiences based on the device being used.

What are device-detector-js's main functionalities?

Detect Device Type

This feature allows you to detect the type of device (e.g., smartphone, tablet, desktop) from a user-agent string.

const DeviceDetector = require('device-detector-js');
const deviceDetector = new DeviceDetector();
const userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3';
const device = deviceDetector.parse(userAgent);
console.log(device.device);

Detect Operating System

This feature allows you to detect the operating system (e.g., Windows, macOS, Android) from a user-agent string.

const DeviceDetector = require('device-detector-js');
const deviceDetector = new DeviceDetector();
const userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3';
const os = deviceDetector.parse(userAgent);
console.log(os.os);

Detect Browser

This feature allows you to detect the browser (e.g., Chrome, Firefox, Safari) from a user-agent string.

const DeviceDetector = require('device-detector-js');
const deviceDetector = new DeviceDetector();
const userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3';
const browser = deviceDetector.parse(userAgent);
console.log(browser.client);

Other packages similar to device-detector-js

Keywords

FAQs

Package last updated on 05 Apr 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc