I want to show different css files depending on browser that user is using. I want to do this on JS and on client side. I am using code like this.
<script language="javascript" type="text/javascript">
if ((navigator.userAgent.indexOf("MSIE")) >= "0"){
document.write("<link rel=\"stylesheet\" href=\"css/common.IE.css\" type=\"text/css\"
}
if ((navigator.userAgent.indexOf("Chrom")) >= "0"){
document.write("<link rel=\"stylesheet\" href=\"css/common.chrome.css\" type=\"text/css\" />");
}
*The only problem that I this code is not valid. How I can solve the problem. If I check this document with w3 checker. it will show now: Line 22, Column 90: document type does not allow element "link" here*****
…nt.write("<link rel='stylesheet' href='css/common.IE.css' type='text/css' />");
Line 25, Column 35: an attribute value must be a literal unless it contains only name characters
document.write("<link rel=\"stylesheet\" href=\"css/common.chrome.css\"…