New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mobile-device-detect

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobile-device-detect

Helpers for handling mobile devices

  • 0.4.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

mobile-device-detect

Helpers for handling mobile devices in javascript.

Installation

To install, you can use npm or yarn:

npm install mobile-device-detect --save

or

yarn add mobile-device-detect

Usage

Import any helper to your component, for example, in Vue.js:

<script>
import { isMobile } from 'mobile-device-detect';
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: isMobile ? 'Welcome to Your Vue.js mobile App!' : 'Welcome to Your Vue.js App'
    }
  }
}
</script>

pass it to template:

<template>
  <div class="hello">
    {{ msg }}
  </div>
</template>

For react example, you can look into separated package react-device-detect

Selectors

PropertyReturn typeDescription
isMobileboolreturns true if device type is mobile or tablet
isMobileOnlyboolreturns true if device type is mobile
isTabletboolreturns true if device type is tablet
isBrowserboolreturns true if device type is browser
isSmartTVboolreturns true if device type is smarttv
isWearableboolreturns true if device type is wearable
isConsoleboolreturns true if device type is console
isAndroidboolreturns true if os type is Android
isWinPhoneboolreturns true if os type is Windows Phone
isIOSboolreturns true if os type is iOS
isChromeboolreturns true if browser is Chrome
isFirefoxboolreturns true if browser is Firefox
isSafariboolreturns true if browser is Safari
isOperaboolreturns true if browser is Opera
isIEboolreturns true if browser is Internet Explorer
isEdgeboolreturns true if browser is Edge or Edge Chromium
isYandexboolreturns true if browser is Yandex
isChromiumboolreturns true if browser is Chromium
isMobileSafariboolreturns true if browser is Mobile Safari
osVersionstringreturns os version (e.g 7 for Windows or 6 for Android)
osNamestringreturns os name (e.g Windows, Android)
fullBrowserVersionstringreturns full browser version (e.g 65.0.3325.181 for Chrome)
browserVersionstringreturns browser major version (e.g 65 in Chrome or 9 in IE)
browserNamestringreturns browser name
mobileVendorstringreturns mobile device vendor (e.g LG, iPhone etc)
mobileModelstringreturns mobile device model (e.g Nexus 5)
engineNamestringreturns browser engine name (e.g Gecko for FF or WebKit for Chrome)
engineVersionstringreturns engine version
getUAstringreturns user agent
deviceTypestringreturns device type (e.g mobile or tablet)
isIOS13booleanreturns true/false if device is running on iOS13
isIPhone13booleanreturns true/false if device is iPhone and running on iOS13
isIPad13booleanreturns true/false if device is iPad and running on iOS13
isIPod13booleanreturns true/false if device is iPod and running on iOS13
isElectronbooleanreturns true/false if running on Electron
isEdgeChromiumbooleanreturns true/false if browser is Edge Chromium
isLegacyEdgebooleanreturns true if browser is Edge
isWindowsbooleanreturns true/false if os is Windows
isMacOsbooleanreturns true/false if os is Mac OS
deviceDetectfunctionreturn data object which includes all data about device (e.g version, engine, os etc.)

License

MIT

Keywords

FAQs

Package last updated on 15 Jun 2020

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