Skip to content Skip to sidebar Skip to footer

Dynamic Css Loading In Ie Won't Work

I have a button in my page, and onclick event, if should append to the a CSS file from a server and do something else. it works perfectly in FF but in IE, it seems not

Solution 1:

Try this function:

function include_css(url) {
var page = document.getElementsByTagName('head')[0],
        cssElem = document.createElement('link');

        cssElem.setAttribute('rel', 'css');
        cssElem.setAttribute('type', 'text/css');
        cssElem.setAttribute('href', url);

        page.appendChild(cssElem);
}

Post a Comment for "Dynamic Css Loading In Ie Won't Work"