I am trying to detect the Windows operating system and assign a specific stylesheet for Windows only. Below is the code snippet I have been using:
$(function() {
if (navigator.appVersion.indexOf("Win")!=-1)
{
$(document.body).append("<link rel='stylesheet' href='../assets/scss/ts-v2-window-style.css'>");
}
});
The code works as expected by excluding Mac users and applying the styles to Windows users, however, I am encountering an issue where it does not recognize $
. Can anyone spot what might be wrong with this code and provide guidance on how to fix it?
Your help would be greatly appreciated. Thank you.