GitPedia

Platform.js

A platform detection library.

From bestiejs·Updated May 26, 2026·View on GitHub·
·Archived

A platform detection library that works on nearly all JavaScript platforms. The project is written primarily in JavaScript, distributed under the MIT License license, first published in 2011. It has gained significant community traction with 3,246 stars and 408 forks on GitHub. Key topics include: detection, platform, user-agent.

Platform.js v1.3.6

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:

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

In an AMD loader:

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

Using npm:

shell
$ npm i --save platform

In Node.js:

js
var platform = require('platform');

Usage example:

js
// 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 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.

Contributors

Showing top 12 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from bestiejs/platform.js via the GitHub API.Last fetched: 6/16/2026