So I'm trying to load a different css stylesheet if IE is detected.
My code:
<head>
<!-- other scripts and stylesheets -->
<!--[if IE]>
<link href='css/index_ie.css' rel='stylesheet' type='text/css'>
<![endif]-->
<!--[if !IE]>
<link href='css/index.css' rel='stylesheet' type='text/css'>
<![endif]-->
<script>
(function() {
if (typeof ActiveXObject === "undefined") {
var s = document.createElement('link');
s.href = "css/index.css";
s.rel = "stylesheet";
s.type = "type/css";
document.documentElement.appendChild(s);
}
else {
var s = document.createElement('link');
s.href = "css/index_ie.css";
s.rel = "stylesheet";
s.type = "type/css";
document.documentElement.appendChild(s);
}
})();
</script>
</head>
This loads index.css correctly when not-IE browser. However this is not loading index_ie.css when IE is being used.
PS: testing with IE 10
var s = document.createElement('<link href="css/index_ie.css" rel="stylesheet" tye="text/css"/>');headelement.document.getElementsByTagName("head")[0].appendChild(s).