[whatwg] setting .src of a SCRIPT element

Ian Hickson ian at hixie.ch
Tue Jun 19 19:09:00 PDT 2007


On Mon, 21 May 2007, Hallvord R M Steen wrote:
>
> if you set the src property of a SCRIPT element in the DOM, IE will load 
> the new script and run it. Firefox doesn't seem to do anything (perhaps 
> a more seasoned bugzilla searcher can tell me if it is considered a 
> known bug?).
> 
> I think Opera 8 does what IE does, Opera 9 is buggy.
> 
> I think IE's behaviour is pretty useful and I'd like the spec to make 
> this standards-compliant. It is a common technique to create SCRIPT 
> elements dynamically to load data (particularly because this gets around 
> cross-domain limitations). Firefox's implementation means one has to 
> create a new SCRIPT element each time, keep track of them, and remove 
> them from the document again, whereas with IE's implementation you can 
> have one "data loader" SCRIPT element and set its .src repeatedly.

On Mon, 21 May 2007, Darin Adler wrote:
>
> Is this technique easy to use correctly? What if you set the src before 
> a previous script has finished loading?

I've heard from several implementors that this would be undesirable. The 
spec goes to some lengths to stop it from working, in fact. With the 
definition of XMLHttpRequest, the coming cross-domain nature of that 
element, the ability to use cross-frame communication, and the simple 
workaround of creating a new <script> for each communication, it seems 
there are enough ways to get around the problem that we don't have to 
allow it.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list