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

whodis

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

whodis

A simple device and browser sniffer... mostly using navigator.userAgent (yikes)

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
Maintainers
1
Weekly downloads
 
Created
Source

WhoDis.js

Just a simple little sniffer (that mostly uses navigator.userAgent) so you can rock conditional checks.

Build

npm run build

Uses microbundle to build out in cjs, es, umd.

Dev

npm run dev

Watches for changes in src.

Install (from npm)

npm i whodis

Import (from npm install)

import WhoDis from 'whodis'

Or, import from your file/projects

import WhoDis from ./WhoDis

Or, don't import and just use src/WhoDis.es5.js, which is just an ES5 IIFE.

Usage

import WhoDis from 'who-dis'

// Add class to html
const html = document.querySelector('html');

if ( WhoDis.anyMS() ) {
  html.classList.add('is-ms');
}

if ( WhoDis.IE() ) {
  html.classList.add('is-ie');
}

if ( WhoDis.Safari() ) {
  html.classList.add('is-safari');
}

// bail if mobile
if (WhoDis.anyMobile) return;

Log info on current userAgent

console.log(WhoDis.info)

Current Checks

Mobile

  • Android : WhoDis.Android()
  • BlackBerry : WhoDis.BlackBerry()
  • iOS : WhoDis.iOS()
  • Opera Mini : WhoDis.OperaMini()
  • IE Mobile : WhoDis.IEMobile()
  • Any Mobile (checks all the above) : WhoDis.anyMobile()
  • Touch Screen : WhoDis.Touch()

IEs

  • Edge : WhoDis.Edge()
  • IE : WhoDis.IE()
  • IE10 : WhoDis.IE10()
  • anyMS (IEs and Edge) : WhoDis.anyMS()

Other Browsers

  • Chrome : WhoDis.Chrome()
  • Safari : WhoDis.Safari()
  • Firefox : WhoDis.Firefox()
  • Opera : WhoDis.Opera()

Keywords

FAQs

Package last updated on 26 Mar 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