[Javascript] Including additional javascript files

Alex Robinson latechjavascript at alex.cloudband.com
Tue Apr 5 07:25:21 CDT 2005


Mr Clover's other good points are duly noted.

>>  Last observation is that some browsers halt execution of the current
>>js file while loading the next one and others carry on regardless.
>
>Really, what browser? This *should* be consistent as the behaviour of
>document.write() has been defined back 
>to >Netscape/someoldversion.mumble. The including script should run 
>up to
>the end of its own <script> block, then the browser will pause parsing
>the page at the new document.written <script> block. I believe the
>including script can still execute stuff from events or timeouts while
>waiting for the included script to download, but once it does 
>download >it should be executed all at once, excluding the including 
>script until >it's finished.

What I meant was... well, in the page I knocked up to test Allard's 
suggestion, the order that the alerts fire differs from browser to 
browser.

A -> B -> C
Safari, Firefox (and presumably other Mozillas)

C -> B -> A
IE/Mac 5, Operas 5 through 8b3

I can't recall for sure IE/PC's behaviour for sure (and I haven't got 
a Windows box here to check) but I think it did A -> B -> C.

Whether or not this could be a gotcha depends on how sloppily you code I guess.



More information about the Javascript mailing list