This JavaScript version has been tested on Chrome and Firefox, with expected functionality on Opera as well. Simply paste this code at the bottom of your webpage just before the closing
document.addEventListener("DOMContentLoaded",browsercss);
function browsercss() {
navigator.sayswho = function () {
var c = navigator.userAgent,
b, a = c.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if (/trident/i.test(a[1])) return b = /\brv[ :]+(\d+)/g.exec(c) || [], "IE " + (b[1] || "");
if ("Chrome" === a[1] && (b = c.match(/\bOPR\/(\d+)/), null != b)) return "Opera " + b[1];
a = a[2] ? [a[1], a[2]] : [navigator.appName, navigator.appVersion, "-?"];
null != (b = c.match(/version\/(\d+)/i)) && a.splice(1, 1, b[1]);
return a.join(" ")
}();
var stylesheet = "";
if (navigator.sayswho.indexOf('Chrome') >= 0) {
stylesheet = 'http://example.com/chrome.css';
}
if (navigator.sayswho.indexOf('Mozilla') >= 0) {
stylesheet = 'http://example.com/mozilla.css';
}
if (navigator.sayswho.indexOf('Opera') >= 0) {
stylesheet = 'http://example.com/mozilla.css';
}
loadcss = document.createElement('link');
loadcss.setAttribute("rel", "stylesheet");
loadcss.setAttribute("type", "text/css");
loadcss.setAttribute("href", stylesheet);
document.getElementsByTagName("head")[0].appendChild(loadcss);
}