Since Windows doesn't support Helvetica, I've been thinking of using jQuery to detect the operating system that the user is using, and change the font of some text accordingly. Here's the code I've written so far, but it doesnt seem to be working (the operating system was detected successfully tho):
<script>
$(document).ready(function() {
var OSName = "Unknown OS";
if (navigator.appVersion.indexOf("Win") != -1){
OSName = "Windows";
$('h1').css('font-family:"Arial",sans-serif;');
}
else if (navigator.appVersion.indexOf("Mac") != -1)
OSName = "MacOS";
else if (navigator.appVersion.indexOf("X11") != -1)
OSName = "UNIX";
else if (navigator.appVersion.indexOf("Linux") != -1)
OSName = "Linux";
console.log('Operating system: ' + OSName);
});
</script>
I'm wondering if I put it at the wrong place. Am i supposed to put it in the <head></head>
block or <body></body>
block?
Thanks!
EDIT: actually I have the .otf file on my server and declared @font-face but it just didn't work for some reason...
@font-face{
font-family: HelveticaNeue-Ultralight;
src: url('/fonts/HelveticaNeue-UltraLight.otf');
}