• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Javascript and appending to the Head

puffpio

Golden Member
The following JS code is executed in the Body of a page, before the entire document has finished loading. The Head is already finished loading:

-----

var scriptelement = document.createElement("script");
scriptelement.setAttribute("type", "text/javascript");
scriptelement.setAttribute("charset", "utf-8");
scriptelement.setAttribute("src", "foobarauieboegia a real path here");

document.getElementsByTagName("head").item(0).appendChild(scriptelement);

------

this works fine in Chrome and FF, but is freezing IE.

document.getElementsByTagName("head").item(0) works..it's the appendChild that is causing IE to freeze. any ideas?
 
hmm

i even tried
document.getElementById("agaegaeg").appendChild(scriptelement);

where agaegaeg is a known div already put in the page by the time the JS runs and it still hangs
 
i fixed it
instead of using a appendChild to append a script element to the page, I added a document.writeln("scr"+"ipt>" etc etc);
 
Back
Top