> I want a fallback to the request in case the script is run not by url
> but with open file from the browser, so i need to know if the request
> is working or not

Without questioning the need to handle errors from Request in general,
I  think  you  should  trap the fact that you're running from the file
system as early as possible, set a flag, and just short-circuit before
you  even  try the AJAX calls. Check `location.protocol` (just shorter
than  what  Steve  said).

Another  reason  to  do  it  this  way  is  you  ensure that you won't
confusingly  have a mixture of working and non-working AJAX... say you
have  some  absolute  URLs  or  some  mashed-up  requests to 3rd-party
servers, which would otherwise work unless you force everything local.

--Sandy

Reply via email to