Detect Platform, OS & Orientation – Device.js

Sometimes, we need to take environment-specific actions while working on web projects.

Device.js is a tiny JavaScript library that simplifies writing conditional CSS or JavaScript that is based on the platform, operating system or browser.


The library detects them and adds specific classes to the <html> element, just like <html lang="en" class="android tablet landscape">.

But that’s not all. Device.js has JavaScript methods to detect them too. And there is support for all the major operating systems + browsers.

1 Comment
  1. Reply Praveen October 23, 2013 at 11:49 AM

    I have checked the code of device.js but is a basic version of code.

    An alternate way could be like something which is mention in

Leave a reply