Add a link stylesheet dynamically in the [closed]

Internet explorer will support innerHTML, though it adds reflow this would work:

var headHTML = document.getElementsByTagName('head')[0].innerHTML;
headHTML    += '<link type="text/css" rel="stylesheet" href="https://stackoverflow.com/questions/512070/style.css">';
document.getElementsByTagName('head')[0].innerHTML = headHTML;

Leave a Comment