platform
    Overview
    Documentation
    Insights
    Code
    Contributors
    Dependencies
    Alternatives

platform

A platform detection library that works on nearly all JavaScript platforms.

1.3.5  •  Published 2 years ago  •  by bestiejs  •  MIT License

A platform detection library that works on nearly all JavaScript platforms.

Disclaimer

Platform.js is for informational purposes only & not intended as a substitution for feature detection/inference checks.

Documentation

Installation

In a browser:

<script src="platform.js"></script>

In an AMD loader:

require(['platform'], function(platform) {/*…*/});

Using npm:

$ npm i --save platform

In Node.js:

var platform = require('platform');

Usage example:

// on IE10 x86 platform preview running in IE7 compatibility mode on Windows 7 64 bit edition
platform.name; // 'IE'
platform.version; // '10.0'
platform.layout; // 'Trident'
platform.os; // 'Windows Server 2008 R2 / 7 x64'
platform.description; // 'IE 10.0 x86 (platform preview; running in IE 7 mode) on Windows Server 2008 R2 / 7 x64'

// or on an iPad
platform.name; // 'Safari'
platform.version; // '5.1'
platform.product; // 'iPad'
platform.manufacturer; // 'Apple'
platform.layout; // 'WebKit'
platform.os; // 'iOS 5.0'
platform.description; // 'Safari 5.1 on Apple iPad (iOS 5.0)'

// or parsing a given UA string
var info = platform.parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7.2; en; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 11.52');
info.name; // 'Opera'
info.version; // '11.52'
info.layout; // 'Presto'
info.os; // 'Mac OS X 10.7.2'
info.description; // 'Opera 11.52 (identifying as Firefox 4.0) on Mac OS X 10.7.2'

Support

Tested in Chrome 62-63, Firefox 56-57, IE 11, Edge 15-16, Safari 10-11, Node.js 4-8, & PhantomJS 2.1.1.

BestieJS

Platform.js is part of the BestieJS “Best in Class” module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, & plenty of documentation.

How do you feel about the name Devstore for this site?

Popularity

Weekly Downloads
734.4K
Stars
2.5K

Maintenance

Development

Last ver 2 years ago
Created 8 years ago
Last commit 5 months ago
7 days between commits

Technology

Node version: 8.9.3
0 unpacked

Compliance

MIT License
OSI Approved
0 vulnerabilities

Contributors

20 contributors
jdalton
Maintainer, 301 commits, 10 merges
Works at Salesforce
Benjamin Tan
Maintainer, 88 commits, 3 merges, 1 PRs
Mathias Bynens
Maintainer, 7 commits
Works at Google
Mike Taylor
5 commits, 3 PRs
Works at mozilla
trangsinh87
2 commits, 2 PRs
Guy Vider
1 commits, 1 PRs
Works at Traveling Tech Guy LLC

Tags

environment
platform
ua
useragent
Ready for the next level?
Join Devstore's founding team to help us build the ultimate open-source app store, work with the latest technologies, and enjoy great culture, impact and autonomy
© 2019 Devstore, Inc.
Devstore helps developers find and use open-source packages, so they can focus on building amazing things