Ok, my temporary fix has been to alter the following block of code from line 2656 in jquery 1.2.6:
// If we're requesting a remote document // and trying to load JSON or Script with a GET if ( s.dataType == "script" && type == "GET"){ //&& remote.test(s.url) && remote.exec(s.url)[1] != location.host ) { var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); I have commented out the second part of the IF statement which tests whether the URL is remote. This will force all scripts to use the <script src=??? and onreadystatechange / onload events whether they are remote or local. I'd be interested in hearing why using the alternative way for local scripts is better. Cheers, Mark. On Sep 16, 11:57 am, robert_shipley <[EMAIL PROTECTED]> wrote: > Posted by Rob on Behalf of Mark... > > I've been doing a little investigation into this (I'm a colleague of > Rob's) and we are still experiencing the issue in Firefox 3. I'm > afraid it's very difficult for me to produce an example of this as we > are using quite a complex set of getScript calls in our website and > can't make this available to the outside world. I've managed to > generate a replica of the page here:http://www.tcc-net.com/jquery-getscript/ > > Here are my findings todate: > > - We are calling getScript to retrieve local javascript files. > - As soon as the file is loaded, we attempt to execute a function > within the script. > > I put a few console.log messages into the files (Firebug uses > console.log for debugging) to output messages at certain points. The > key ones were a message at the end of the file being retrieved ("end > of tablesorter") with getScript and one in the callback ("would > trigger") which is triggered on (apparent) completion of the load. > > Most of the time, these appear in the console in the correct order > ("end of tablesorter" => "would trigger"). Occasionally, however, > they appear the alternate way around and this is when the error > (myMethod() is not a valid function, or words to those effect) is > seen. > > I therefore deduce that the callback is being triggered before the > execution of the javascript is complete (even though it is loaded, it > has not executed fully). It is down to a race as to whether the > callback is triggered first or the script completes execution. > > Looking at the jQuery code, and I am claiming no expertise here so I > may well be wrong, it seems that the "globalEval" function is used to > execute a local script once downloaded. I do not see anywhere in this > function, however, where there are any checks on whether the script > has fully executed. > > It might be that in IE6, IE7, FF < 3 the execution of the javascript > is paused until the inserted script element has been executed, and in > FF3, no such pause occurs. I am hypothesising here though, and really > don't have enough information on how this method of script loading > works internally. > > I'm posting this information here more to see if it triggers any > thoughts in those more experienced jQuery contributors. In the > meantime, I will continue my own investigations. > > Cheers, > > Mark.