i need check if web page has font awesome in it. if not i'm going load javascript. kinda how facebook sdk checks see if there script element containing id "facebook-jssdk", if returns (does nothing), if not loads it. need font awesome.
i think best way check font-awesome, i'm not sure if it's slower loading again if there.
function css(element, property) { return window.getcomputedstyle(element, null).getpropertyvalue(property); } window.onload = function () { var span = document.createelement('span'); span.classname = 'fa'; span.style.display = 'none'; document.body.insertbefore(span, document.body.firstchild); if ((css(span, 'font-family')) !== 'fontawesome') { // add local fallback } document.body.removechild(span); };
Comments
Post a Comment