OS Detection

Developer
Size
2,026 Kb
Views
22,264

How do I make an os detection?

Will be used by my download page to determine/show the appropriate download information.. What is a os detection? How do you make a os detection? This script and codes were developed by John Lueders on 20 November 2022, Sunday.

OS Detection Previews

OS Detection - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>OS Detection</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <p id="myText">The OS Info will go here.</p>
<p class="os win">You have a Windows computer!</p>
<p class="os mac">You have a Mac!</p> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

OS Detection - Script Codes CSS Codes

html { background: #333; color: white; padding: 2em;
}

OS Detection - Script Codes JS Codes

// This script sets OSName variable as follows:
// "Windows" for all versions of Windows
// "MacOS" for all versions of Macintosh OS
// "Linux" for all versions of Linux
// "UNIX" for all other UNIX flavors
// "Unknown OS" indicates failure to detect the OS
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";
var myTextField = document.getElementById('myText');
myTextField.innerHTML = 'Your OS: '+OSName;
$(function() { if (OSName === 'Windows') { $('.win').show(); $('.mac').hide(); } else if (OSName === 'MacOS') { $('.win').hide(); $('.mac').show(); }
});
OS Detection - Script Codes
OS Detection - Script Codes
Home Page Home
Developer John Lueders
Username elmsoftware
Uploaded November 20, 2022
Rating 3
Size 2,026 Kb
Views 22,264
Do you need developer help for OS Detection?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

John Lueders (elmsoftware) Script Codes
Create amazing sales emails with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!