How to find out the client operating system using Javascript / jQuery

| | 1 min read

This is a small article on how we can detect an Operating System (WIndows, Linux, Mac etc) using jQuery. For this first we need to download a plugin from here. Download this file (the name will be jquery.client.js) and copy and paste it in your custom module.

Next I will mention an example how we can check the operating system using this plugin. For example, if you want to add a separate code when your site is running in Windows OS, then you can add the below mentioned code which will work only in Windows OS.

if ($.client.os == "Windows")
    {
        //some code here
    }

So as I mentioned, using this code we can make our site pages behave according to the OS been used. Just download the jQuery plugin and manage your webpages on different operating systems accordingly..