How to detect Operating System on running website using JavaScript ?
To detect the operating system on running website, one can simply use navigator.appVersion or navigator.userAgent property.
The Navigator app Version or userAgent property is a read-only property and it returns a string which represents the operating system information of the browser.
Syntax : Operating System can be detected by either ways
1 |
navigator.appVersion |
1 |
navigator.userAgent |
Embed this script in your code
1 2 3 4 5 6 7 8 9 |
<script type="text/javascript"> /*mac os detaction*/ var system = document.getElementById("boom_body"); if (navigator.userAgent.indexOf('Mac OS X') != -1) { system.className += "mac_os"; } else { system.className += "windows_os"; } </script> |
0 Comments
Share