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.

Device.js

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.

  • http://forum.superhitdeals.in Praveen

    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 http://stackoverflow.com/a/3540295/471026

Search