Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tag: 0.3.1
Fetching contributors…

Cannot retrieve contributors at this time

113 lines (78 sloc) 3.342 kB


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


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


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


The documentation for Platform.js can be viewed here: /docs/

For a list of upcoming features, check out our roadmap.

Installation and usage

In a browser or Adobe AIR:

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

Via npm:

npm install platform

In Narwhal, Node.js, and RingoJS:

var platform = require('platform');

In Rhino:


In RequireJS:

require(['path/to/platform'], function(platform) {

Usage example:

// on IE10 x86 platform preview running in IE7 compatibility mode on Windows 7 64 bit edition; // 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; // 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');; // Opera
info.version; // 11.52
info.layout; // Presto
info.os; // Mac OS X 10.7.2
info.description; // Opera 11.52 on Mac OS X 10.7.2

Cloning this repo

To clone this repository including all submodules, using git 1.6.5 or later:

git clone --recursive
cd platform.js

For older git versions, just use:

git clone
cd platform.js
git submodule update --init

Feel free to fork if you see possible improvements!


  1. Platform.js has been tested in at least Adobe AIR 2.6, Chrome 5-15, Firefox 1.5-8, IE 6-10, Opera 9.25-11.52, Safari 2-5.1.1, Node.js 0.4.8-0.6.1, Narwhal 0.3.2, Ringo 0.7, and Rhino 1.7RC3.



Jump to Line
Something went wrong with that request. Please try again.