New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

is-device-mobile

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-device-mobile

A utility to determine whether the client's device is mobile or not

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

Is Device Mobile?

Background

We often need to change functionality / behavior / layout whether the client's device is mobile or not. This tiny utility will help determining it checking client's maxTouchPoints (or msMaxTouchPoints), (pointer:coarse) Media Queries, orientation or, as last resort, userAgent.

Installation

Install the component in your project with the following command:

yarn add is-device-mobile

Usage

import { isMobile } from 'is-device-mobile';

const getDeviceType = () => {
  return isMobile(window) ? "mobile" : "desktop";
};

In order to work, isMobile requires window as argument.

Resources

This utility follows Mozilla browser detection guidelines

Keywords

mobile

FAQs

Package last updated on 26 Dec 2019

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