I finally have jQuery AJAX down pretty well and have my website all created, but now I’ve arrived at the dreaded IE bugfix stage.
I am trying to do something very basic: insert an extra css for IE7 users. I have this code:
if(navigator.appVersion.indexOf("MSIE 7.0") != -1)
{
var ieCSS = '<link rel="stylesheet" type="text/css" href="common-ie.css" />';
$("head").append(ieCSS);
}
The css is not applied to the page. However, I tested it with alert($(“head”).html()) and saw that for some reason most of the quotes and the / in my inserted html are being parsed out by the browser. This is what comes out:
'<LINK rel=stylesheet type=text/css href="common-ie.css">'
Why is this happening, and how can I get around it?
Just do the following instead of the javascript code your using. Insert this into the head tags like you would any of stylesheet. This will only display for IE 7