Nov 19, 2014

Get Client Operating System Using JQuery

The following piece of code can be used to get Client Operating System . in case you need to execute some code.

$(document).ready(function(){

if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";


if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";

if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";

if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";

alert(OSName);

});

Copy Paste This Code Below And Simply Do What Ever Your Planning To Do With It

<!DOCTYPE html>
<html>
<head>
<title>Client Operating System</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>

window.onload = function () {
var OSName="Unknown OS";

if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";


if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";

if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";

if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";

$("#display").text(OSName);

};
  
</script>
</head>
<body>
<p id="display"></p>
</body>
</html>

No comments:

JWT Token Decode Using Jquery

When it come to authentication we use many mechanism. Ones the user authenticated we must keep these details somewhere safe. So we can share...