views:

39

answers:

2

I need a way to make sure my script won't block the viewed page,
if the server serving the script is down (port 80 is blocked for some reason).

Currently when I test it and take down the server (Apache), or close the firewall,
I see in the browser that it is trying to load the resource (script in that case), without
success for long seconds, until it aborts.

Is there a nice way to get past this issue?

+1  A: 

Perhaps it's time to start using jQuery?

Check out jQuery.ajax() info and search for timeout keyword.

UPDATE:

For this particular solution you could use getScript() to fetch and execute remote scripts.

Andrejs Cainikovs
This isn't the same thing, the javascript file itself is timing out, jQuery won't do anything to solve this.
Nick Craver
Why that? In the similar manner one could load a script and execute it locally.
Andrejs Cainikovs
Is it get parsed right away? it's a bit of an ugly solution..
vsync
Please check updated answer.
Andrejs Cainikovs
well, this requires me to tell the website which installs my script, to also install jQuery.
vsync
...or you could load it from your script :-)http://www.codehouse.com/javascript/articles/external/
Andrejs Cainikovs
A: 

A recent post from Steve Souders analyzes this problem : Frontend - Single Point of Failure, by browsers and type of failure

Felipe Alsacreations