is-mobile-browser

0.0.1 • Public • Published

is-mobile-browser

Determine if device making the request is a mobile device mobile device like

Mozilla/5.0 (Linux; U; Android 2.1; en-us; GT-I9000 Build/ECLAIR) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2

You can use it to detect and serve a different page to the user.

Example

var mobile = require('is-mobile-browser');
 
mobile('Mozilla/5.0 (Linux; U; Android 2.1; en-us; GT-I9000 Build/ECLAIR) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2'); // true
mobile('Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5'); // true
mobile('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36'); // false

Installation

$ npm install is-mobile-browser

Licence

MIT

Package Sidebar

Install

npm i is-mobile-browser

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • abpai