Using jquery to inject a style sheet seems to break IE7/8. The scenario was when a user passed in a custom param via the URL the code would inject that particular css. Ideally I should have gone with the native javascript way to create the element since it’s still clean and simple. This may not be an issue, but for my particular scenario it was the case.

jQuery version:


$('head').append($('<link rel="stylesheet" type="text/css" />')
         .attr('href', 'http://www.somedomain.com/css/cool.css'));

Native version:


var link = document.createElement('link');
    link.href = 'http://www.somedomain.com/css/cool.css';
    link.rel = 'stylesheet';
    link.type = 'text/css';
    document.getElementsByTagName('head')[0].appendChild(link);