5.0.0 • Published 8 years ago

detect-mobile-browser v5.0.0

Weekly downloads
355
License
MIT
Repository
github
Last release
8 years ago

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
5.0.0

8 years ago

4.0.0

8 years ago

3.1.6

8 years ago

3.1.5

9 years ago

3.1.4

9 years ago

3.1.3

9 years ago

3.1.2

9 years ago

3.1.1

9 years ago

3.1.0

9 years ago

3.0.0

9 years ago

2.0.0

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago