Forum Moderators: open
Note: Starting in Firefox 3.1, you can no longer use this method to append script elements that retrieve their code from anything other thanchrome:URLs.
I'm assuming this is a security enhancement and am a bit disappointed that I will no longer have this option available. I use it quite often in development to include scripts from other libraries when necessary. In light of the new information I realize I must reform my methods. I'm interested to hear others thoughts on workarounds ...
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'test.js';
document.getElementsByTagName('head')[0].appendChild(script);
One week later and no responses anywhere. I've posted in the mozilla forums and searched the mailing lists but have come up empty. Nobody else curious or concerned about this pending change? It could potentially break quite a few pages, those that rely on attaching scripts using the DOM appendChild method anyway.
seems Draconian in the extreme
Well hello there stranger, great to hear from you. I agree, it is extreme. I have been searching for a mailing list or otherwise where this new "feature" has been discussed and am coming up empty. Do you have any idea where the developers may be discussing this change?
if it's on the same domain shouldn't it be trusted?
That's 3 of us that feel the same way. And I'm not seeing anything in the standard [w3.org] that reads otherwise.
appendChildbehavior in terms of whether the script executes. All that is affected is whether the executing script gets
XPCNativeWrapperautomation and is relevant only to chrome documents. I believe we will see an update to the documentation soon.