Maybe you could attach an "onload" or "onerror" event to your html element
(script) ?
Anyway, jQuery has a home made method to let you do this, cross-browser:
See http://docs.jquery.com/Ajax/jQuery.getScript#urlcallback

Matt

2007/10/9, Jacky <[EMAIL PROTECTED]>:
>
> 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




-- 
Matthias ETIENNE

Reply via email to