To accomplish this task, start by identifying the platform they are using and then utilize an if statement to generate a stylesheet link.
function getOS() {
var userAgent = window.navigator.userAgent,
platform = window.navigator.platform
macosPlatforms = ["Macintosh", "MacIntel", "MacPPC", "Mac68K"],
windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"],
iosPlatforms = ["iPhone", "iPad", "iPod"],
os = null;
if (macosPlatforms.indexOf(platform) !== -1) {
os = "Mac OS";
} else if (iosPlatforms.indexOf(platform) !== -1) {
os = "iOS";
} else if (windowsPlatforms.indexOf(platform) !== -1) {
os = "Windows";
} else if (/Android/.test(userAgent)) {
os = "Android";
} else if (!os && /Linux/.test(platform)) {
os = "Linux";
}
return os;
}
if (getOS() == "Windows") {
var head = document.getElementsByTagName("HEAD")[0];
var link = document.createElement("link");
link.rel = "stylesheet";
link.type = "text/css";
link.href = "your-css-file-name.css"; // Replace "your-css-file-name.css" with your actual CSS file name
head.appendChild(link);
}
Note: Make sure to replace 'your-css-file-name.css' with the appropriate name of your CSS file.
We hope these guidelines are helpful in achieving your goal.