/    Sign up×
Community /Pin to ProfileBookmark

Pages freeze when server is down.

Hi,

Does anybody know how to prevent the browser from hanging when a Javascript references a script on a remote server, in the case when the remote server is unavailable or down.

For example, we offer the following script as a free service, but if our server is down or isolated from the network, then the script not only ceases to operate, but blocks the loading of the entire page that it is on.

// To display the national flag of
// the viewer’s country.
<script language=”Javascript” src=”http://map.geoup.com/geoup?template=flag”></script>

What would be really cool, would be if we could fail gracefully or load the script src from an alternate server. As a minimum, we would like to at least be able to let the page continue loading.

BTW, I am not sure if it is relevant or not, but the script does not always load an image, as in the flag above, it can also be used to return a phrase – as in
<script language=”Javascript” src=”http://map.geoup.com/geoup?template=welcome”></script>
which displays a localized welcome message which refers to the viewers city.

Any ideas?

Kind Regards
Russell Turner
Geobytes, inc.
[url]http://www.geobytes.com/[/url]
Geobytes – because everybody’s somewhere!

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@BestZestJan 08.2003 — I don't know if this will work but you could try the 'onError' event handler.

BestZest
Copy linkTweet thisAlerts:
@OneillauthorJan 23.2003 — Thanks BestZest for your reply earlier, sorry i couldnt have said that sooner. We had already considered using onError, however I am told we cannot use this to overcome our problem, I think last I checked they were tinkling with some way of contacting the server to make sure it is there, or something... thanks for your suggestion though any suggestions are great.
Copy linkTweet thisAlerts:
@khalidali63Jan 23.2003 — If you are not using any other server side programming language then using only JavaScript actually limits your ability to ping a server in any way.

In NS6+/mozilla1+ browsers you can use LiveConnect to call Java classes and have them take care of some thing like this.

Other then that I think you will have to resort to image.onError event,

and by the way it works prety good if it is used properly.

cheers

Khalid
Copy linkTweet thisAlerts:
@HiMyNameIsAug 30.2003 — Can anyone provide insight on this problem? We're now having the same issue.
Copy linkTweet thisAlerts:
@Khalid_AliAug 31.2003 — well here is an option,it does work,however will it fit in your problem thats completely up to you to see..:-)

http://www.webapplikations.com/pages/html_js/document/FindOutAServerIsUp.html
×

Success!

Help @Oneill spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...