OS Detection
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 - 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(); }
});
Developer | John Lueders |
Username | elmsoftware |
Uploaded | November 20, 2022 |
Rating | 3 |
Size | 2,026 Kb |
Views | 22,264 |
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!
Name | Size |
Project Shell | 2,320 Kb |
Resize - 3 Breakpoints | 2,495 Kb |
John Lueders Resume | 8,548 Kb |
WP Archive | 3,328 Kb |
Material Design Elements | 2,668 Kb |
Kindergarten Project | 2,220 Kb |
Tooltip | 1,747 Kb |
Ministry Tiles | 3,505 Kb |
Subtle Paper Curl | 2,608 Kb |
IDo Icons | 5,687 Kb |
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!
Name | Username | Size |
Shopping cart | Andiio | 6,581 Kb |
Obligatory CSS3 UI Nav | Romandiaz | 9,017 Kb |
Part 19 Bootstrap split button dropdown | Venkatesha | 1,601 Kb |
Codero Sitemap | S1m0ne | 28,169 Kb |
JQuery exercise | Brian-baum | 3,780 Kb |
A Pen by Ben Babics | Benbabics | 2,957 Kb |
Countdown with Rings | Ewganoel | 2,490 Kb |
Exploding Text | Jjmartucci | 4,749 Kb |
Subscription Newsletter - Before inlining | Bradstrong | 7,526 Kb |
Single element checkbox | Ivijaygupta | 1,996 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!