If the server return something like 404/500 page, I guess it would cause a javascript error when browser try to evaluate, and the try-catch method could work.
Timer would be a good idea, but to determine the time to wait would require some specific measure. -- Best Regards, Jacky 網絡暴民 http://jacky.seezone.net On 10/9/07, Scott Trudeau <[EMAIL PROTECTED]> wrote: > > > I actually posted to the dev list about a similar issue (using JSONP, > which is script-like). I'd like to put a short timer on the script calls > and receive a timeout if the callback function fails to fire. > > Scott > > On 10/8/07, Jacky <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I would like to call crossite script. > > So I use the script tag technique (create script tag, assign src and > > append to head) to do so. > > But unlike xmlhttprequest, I cannot get any response status from it. > > So I just wonder if there is anyway I can detect if the remote script is > > not available? > > > > I tried to use try-catch, which works on Firefox but not IE. Code: > > > > $(document).ready(function(){ > > try{ > > var s = document.createElement("script"); > > s.type = "text/javascript"; > > s.src = " http://thisurldoesnotexist/dsfsdlfjk.js "; > > document.appendChild(s); > > } > > catch(e){ > > alert("any error"); > > } > > }); > > > > -- > > Best Regards, > > Jacky > > 網絡暴民 http://jacky.seezone.net > > > > > -- > -- > Scott Trudeau > scott.trudeau AT gmail DOT com > http://sstrudeau.com/ > AIM: sodthestreets