Friday, 27 September 2013

How to append straight markup to HEAD without jQuery?

How to append straight markup to HEAD without jQuery?

I have a string containing HTML for stylesheets (created via the Rails
asset pipeline), and I need to append this to the head and have the
stylesheets actually load, in all major browsers. The string looks like
this:
<link
href="https://www.v.me/assets/core-28020ec7a202f8bc47a5d70d5aeb8477.css"
media="screen" rel="stylesheet" type="text/css" />
<link
href="https://www.v.me/assets/widgets-d4c93376a05ffe6d726371b89bc58731.css"
media="screen" rel="stylesheet" type="text/css" />
<link
href="https://www.v.me/assets/flowplayer-minimalist-3254ab41f4865c79282728f0012bb98d.css"
media="screen" rel="stylesheet" type="text/css" />
<link
href="https://www.v.me/assets/main-12765c4980ba6d109852c52830b34586.css"
media="screen" rel="stylesheet" type="text/css" />
I need to do this without using jQuery. Is this possible?
I wish I had the URLs in an array, but I don't. As a last resort, I could
consider using a regex to parse out the URLs, but I'd like to avoid this.

No comments:

Post a Comment