Name Date Size

..25-Oct-20244 KiB

LICENSEH A D25-Oct-2024640

package.jsonH A D25-Oct-20241,013

README.mdH A D25-Oct-20242.2 KiB

README.md

1# Platform.js v1.3.5
2
3A platform detection library that works on nearly all JavaScript platforms.
4
5## Disclaimer
6
7Platform.js is for informational purposes only & **not** intended as a substitution for feature detection/inference checks.
8
9## Documentation
10
11* [doc/README.md](https://github.com/bestiejs/platform.js/blob/master/doc/README.md#readme)
12* [wiki/Changelog](https://github.com/bestiejs/platform.js/wiki/Changelog)
13* [wiki/Roadmap](https://github.com/bestiejs/platform.js/wiki/Roadmap)
14* [platform.js demo](https://bestiejs.github.io/platform.js/) (See also [whatsmyua.info](https://www.whatsmyua.info/) for comparisons between platform.js and other platform detection libraries)
15
16## Installation
17
18In a browser:
19
20```html
21<script src="platform.js"></script>
22```
23
24In an AMD loader:
25
26```js
27require(['platform'], function(platform) {/*…*/});
28```
29
30Using npm:
31
32```shell
33$ npm i --save platform
34```
35
36In Node.js:
37
38```js
39var platform = require('platform');
40```
41
42Usage example:
43
44```js
45// on IE10 x86 platform preview running in IE7 compatibility mode on Windows 7 64 bit edition
46platform.name; // 'IE'
47platform.version; // '10.0'
48platform.layout; // 'Trident'
49platform.os; // 'Windows Server 2008 R2 / 7 x64'
50platform.description; // 'IE 10.0 x86 (platform preview; running in IE 7 mode) on Windows Server 2008 R2 / 7 x64'
51
52// or on an iPad
53platform.name; // 'Safari'
54platform.version; // '5.1'
55platform.product; // 'iPad'
56platform.manufacturer; // 'Apple'
57platform.layout; // 'WebKit'
58platform.os; // 'iOS 5.0'
59platform.description; // 'Safari 5.1 on Apple iPad (iOS 5.0)'
60
61// or parsing a given UA string
62var 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');
63info.name; // 'Opera'
64info.version; // '11.52'
65info.layout; // 'Presto'
66info.os; // 'Mac OS X 10.7.2'
67info.description; // 'Opera 11.52 (identifying as Firefox 4.0) on Mac OS X 10.7.2'
68```
69
70## Support
71
72Tested in Chrome 82-83, Firefox 77-78, IE 11, Edge 82-83, Safari 12-13, Node.js 4-14, & PhantomJS 2.1.1.
73
74## BestieJS
75
76Platform.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.
77