document.head.appendChild(element) ie ie7 and ie8 document.head.appendChild(element) ie ie7 and ie8 javascript javascript

document.head.appendChild(element) ie ie7 and ie8


According to https://developer.mozilla.org/en-US/docs/Web/API/document.head and http://msdn.microsoft.com/en-us/library/gg593004%28v=vs.85%29.aspx , document.head isn't available to IE<9. Just use

document.getElementsByTagName('head')[0].appendChild(requireTag);


I believe document.head isn't supported in those browsers.

Try this instead:

var head = document.getElementsByTagName("head")[0];head.appendChild(requireTag);