I don’t see why this doesn’t work. I assume that for some really lame reason an if statement might not be able to validate a string of text but that would make me very angry at who’s writing these scripting languages.
//I don't want to know the browser. I want to know the layout engine the user is using.
if($.layout.name == "webkit"){$("#debug").html("your browser uses webkit");}
//I eventually want to do this
if($.layout.name == "webkit"){
document.write('<link rel="stylesheet" href="/css/webkit-name-v006.css" type="text/css" media="screen">');
}
I looked all over for documentation on how to use the jquery.browser plugin but they only give info for detecting the specific browser name they do not give examples for checking for layout engine.
//this is the closest working example I found online
$.browser.safari = /safari/.test(navigator.userAgent.toLowerCase()); if ($.browser.safari) {
document.write('<link rel="stylesheet" href="http://domain.tld/css/safari.css" type="text/css" media="screen">'); }
I need to write a script that chooses the CSS file based on browser layout, not version.
I don’t wanna hear any hype about feature detection. I have been there and seen it’s error.
Just wanna make this work.
Thanks.
//FOUND THE ANSWER
I was putting the code in an if statement string and for got to say “else if”
Here is the working code