我不明白为什么这不起作用。我认为由于某些非常蹩脚的原因,if 语句可能无法验证一串文本,但这会让我对谁在编写这些脚本语言感到非常生气。
//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">');
}
我到处寻找有关如何使用 jquery.browser 插件的文档,但它们仅提供用于检测特定浏览器名称的信息,而没有提供用于检查布局引擎的示例。
//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">'); }
我需要编写一个脚本,根据浏览器布局而不是版本来选择 CSS 文件。
我不想听到任何关于特征检测的炒作。我去过那里,看到它的错误。只是想让这项工作。
谢谢。