views:

368

answers:

1

I'm adding a CSS link tag at runtime, it works in all the browsers except for chrome, which simply refuses to use the CSS, Its a PHP script file in which a header('Content-Type: text/css;); has been added as follows

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

As u can see, I'm using jQuery to append the link. It works on all browsers, IE6+, Firefox, Safari(windows) but not Chrome. Any help!?

+2  A: 

Try adding the tag to the head:

$('head').append(css);
Pim Jager
hey!!that worked like a charm,thanks a lot
ruturaj
Then you should accept the answer, no? =)
David Thomas