1document.getElementsByTagName("head")[0].insertAdjacentHTML(
2 "beforeend",
3 "<link rel=\"stylesheet\" href=\"path/to/style.css\" />");
1var cssId = 'myCss'; // you could encode the css path itself to generate id..
2if (!document.getElementById(cssId))
3{
4 var head = document.getElementsByTagName('head')[0];
5 var link = document.createElement('link');
6 link.id = cssId;
7 link.rel = 'stylesheet';
8 link.type = 'text/css';
9 link.href = 'http://website.com/css/stylesheet.css';
10 link.media = 'all';
11 head.appendChild(link);
12}
13
1var cssFile = document.createElement('link');
2 cssFile.rel = 'stylesheet';
3 cssFile.href = "styles.css"; // or path for file {themes('/styles/mobile.css')}
4 document.head.appendChild(cssFile); // append css to head element
1var cssFile = document.createElement('link');
2 cssLink1.rel = 'stylesheet';
3 cssLink1.href = "styles.css"; // or path for file {themes('/styles/mobile.css')}
4 document.head.appendChild(cssFile); // append css to head element
5