MozillaZine

appendChild SCRIPT elements

Discussion about official Mozilla Firefox builds
coopster
 
Posts: 4
Joined: March 21st, 2007, 9:07 am

Post Posted February 19th, 2009, 6:23 pm

Note: Starting in Firefox 3.1, you can no longer use this method to append script elements that retrieve their code from anything other than chrome: URLs.
Resource: appendChild


I have been searching trying to find changelogs or discussion on this proposed change in Firefox. Unless I am misunderstanding the note on the Mozilla documentation page for appendChild, we will no longer be able to append a <script> element in the following manner:

Code: Select all
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = 'test.js';
        document.getElementsByTagName('head')[0].appendChild(script);

Does anybody know where I can read more about this change?
Why it is being incorporated?
And does anybody have any suggested workarounds if this does indeed make it's way into production release?

Bluefang

User avatar
 
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont

Post Posted February 19th, 2009, 7:39 pm

This was most likely done for security reasons. Can't find any documentation on it though.
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...

coopster
 
Posts: 4
Joined: March 21st, 2007, 9:07 am

Post Posted February 26th, 2009, 1:19 pm

I'm guessing you are correct in your assumption regarding security, I leaned that way in my first thoughts too. However, I can use alternative methods to include JavaScript dynamically, including the old document.write fallback so it seems unnecessary. I've been watching and poking around for a week but have still come up empty.

Anybody know where I can find the developers mailing list or changelogs/cvs/svn documents?

Bluefang

User avatar
 
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont

Post Posted February 26th, 2009, 2:37 pm

To be honest, I can't find any documentation of this anywhere. And as far as i can tell, Firefox still allows doing this... so I have no idea what to make of it.
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...

Return to Firefox Builds


Who is online

Users browsing this forum: No registered users and 4 guests