Platform.js v1.3.5
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:
platform.name;
platform.version;
platform.layout;
platform.os;
platform.description;
platform.name;
platform.version;
platform.product;
platform.manufacturer;
platform.layout;
platform.os;
platform.description;
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;
info.version;
info.layout;
info.os;
info.description;
Support
Tested in Chrome 82-83, Firefox 77-78, IE 11, Edge 82-83, Safari 12-13, Node.js 4-14, & 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.