Google Chrome stylesheet tag at runtime

I add a CSS link tag at runtime, it works in all browsers except chrome which just refuses to use CSS, my PHP script file where the header is ('Content-Type: text / CSS;); was added as follows

var css;
css = '<link rel="stylesheet" type="text/css" href="http:/domain.com/cm.css?c=someval"/>';
$(css).appendTo("body");

      

As I can see I am using jQuery to add a link. It works in all browsers, IE6 +, Firefox, Safari (windows), but not Chrome. Any help !?

0


a source to share


1 answer


Try adding a tag to your head:



$('head').append(css);

      

+2


a source







All Articles