Socket
Socket
Sign inDemoInstall

detect-mobile-browser

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-mobile-browser

It is a very simple & small javascript plugin to detect all major modern mobile browsers.


Version published
Maintainers
1
Created
Source

Build NPM Version NPM Downloads Inline docs Coverage Status
NPM

Detect Mobile Browser

Small plugin to detect mobile browser

Usage Frontend:-

alert(SmartPhone.isAndriod());

OR

alert(SmartPhone.isAny());

OR (browserify):

var SmartPhone = require('detect-mobile-browser')(false);
module.exports = (function($) {
    $(document).ready(function() {
      alert(SmartPhone.isAny());
    });
})(jQuery);

Usage Backend:-

Use as an ExpressJS middleware

var mobileBrowser = require('detect-mobile-browser');

...
...

app.use(mobileBrowser());

app.get('/', function (req, res){
    ...
    ...
    //in req
    console.log(req.SmartPhone.isAny());

    ...
    ...

    //in res locals to use in templates
    console.log(res.locals.SmartPhone.isAny());

    ...
    ...

});

Bower

$ bower install browser-detector --save

NPM

$ npm install detect-mobile-browser --save

SPM

$ spm install detect-mobile-browser --save

List of detection functions:

  • isAndroid
  • isBlackBerry
  • isBlackBerryPlayBook
  • isBlackBerry10
  • isIOS
  • isIPhone
  • isIPad
  • isIPod
  • isOpera
  • isWindows
  • isWindowsMobile
  • isWindowsDesktop
  • isFireFox
  • isNexus
  • isKindleFire
  • isPalm
  • isAny

Keywords

FAQs

Package last updated on 22 Oct 2016

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