How to Detect Operating System on the Client Machine using JavaScript? Last Updated : 08 Oct, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report To detect the operating system on the client machine, one can simply use navigator.appVersion property. The Navigator appVersion property is a read-only property and it returns a string that represents the version information of the browser. Syntax:navigator.appVersionExample 1: This example uses the navigator.appVersion property to display the operating system name. html <!DOCTYPE html> <html> <head> <title> How to detect operating system on the client machine using JavaScript ? </title> </head> <body style="text-align:center;"> <h1 style="color:green;">GeeksforGeeks</h1> <button ondblclick="operatingSytem()"> Return Operating System Name </button> <p id="OS"></p> <!-- Script to display the OS name --> <script> function operatingSytem() { let 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 the OS name document.getElementById("OS").innerHTML = OSName; } </script> </body> </html> Output: Example 2: This example uses the navigator.appVersion property to display all the properties of the client machine. html <!DOCTYPE html> <html> <head> <title> How to detect operating system on the client machine using JavaScript ? </title> </head> <body style="text-align:center;"> <h1 style="color:green;">GeeksforGeeks</h1> <button onclick="version()"> Return OS Version </button> <p id="OS"></p> <!-- Script to return OS details --> <script> function version() { let os = navigator.appVersion; // Display the OS details document.getElementById("OS").innerHTML = os; } </script> </body> </html> Output: Comment More infoAdvertise with us Next Article How to Detect Keypress using JavaScript ? A abhishek7 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Questions Similar Reads Detect the Operating System of User using JavaScript The task is detect the operating system of User with the help of JavaScript. we're going to discuss few techniques. Approach: Access the navigator.appVersion or navigator.userAgent property. Get the index of the OS using indexOf() method. If index is other than -1, then it is the OS, that we are loo 2 min read How to detect the browser language preference using JavaScript ? Detecting the language preferences of users can be very important for Websites or Web Apps to increase user interaction. In JavaScript, this task can be easily done by using the Languages property available for the navigator interface. The navigator.language and the navigator.languages property toge 2 min read How to Detect Keypress using JavaScript ? In this article, keyboard detection is performed using HTML and CSS. HTML stands for "Hypertext Markup Language". HTML language helps the developer to create and design web page elements like links, sections, paragraphs, headings, and blockquotes for web applications. CSS stands for "Cascading Style 2 min read How to detect the Internet connection is offline or not using JavaScript? Detecting if the internet connection is offline using JavaScript involves utilizing the navigator.onLine property. This property returns false when the browser is offline and true when connected, allowing you to respond to network connectivity changes in real-time.Syntax: function isOnline() { retur 1 min read How to detect touch screen device using JavaScript? Sometimes you might be looking for some features to include into your web-app that should only be available to devices with a touch screen. You may need this detection while introducing newer smarter controls for touch screen users in the game app or a GPS and navigation application. While there are 3 min read C# Program to Get the Machine Name or Host Name Using Environment Class Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that retrieves command-line arguments information, exit codes information, environme 1 min read Like