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

mobile-detect

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobile-detect

Device detection (phone, tablet, desktop, mobile grade, os, versions)

  • 1.4.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
155K
decreased by-17.26%
Maintainers
1
Weekly downloads
 
Created

What is mobile-detect?

The 'mobile-detect' npm package is a lightweight JavaScript library used to detect mobile devices, operating systems, and user agents. It helps developers tailor their web applications to different devices by providing detailed information about the user's device.

What are mobile-detect's main functionalities?

Detect Mobile Device

This feature allows you to detect if the user is on a mobile device and identify the type of device. The code sample demonstrates how to use the 'mobile' method to get the device type.

const MobileDetect = require('mobile-detect');
const md = new MobileDetect(window.navigator.userAgent);
console.log(md.mobile()); // 'iPhone' for iPhone, 'Android' for Android devices, null for desktop

Detect Operating System

This feature allows you to detect the operating system of the user's device. The code sample shows how to use the 'os' method to get the operating system.

const MobileDetect = require('mobile-detect');
const md = new MobileDetect(window.navigator.userAgent);
console.log(md.os()); // 'iOS' for iPhone, 'AndroidOS' for Android devices, null for desktop

Detect User Agent

This feature allows you to detect the user agent of the browser. The code sample demonstrates how to use the 'userAgent' method to get the browser's user agent.

const MobileDetect = require('mobile-detect');
const md = new MobileDetect(window.navigator.userAgent);
console.log(md.userAgent()); // 'Safari' for Safari browser, 'Chrome' for Chrome browser, etc.

Detect Phone Model

This feature allows you to detect the specific phone model. The code sample shows how to use the 'phone' method to get the phone model.

const MobileDetect = require('mobile-detect');
const md = new MobileDetect(window.navigator.userAgent);
console.log(md.phone()); // 'iPhone' for iPhone, 'Nexus' for Nexus devices, etc.

Other packages similar to mobile-detect

Keywords

FAQs

Package last updated on 13 Mar 2021

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