[current]
What I'm trying to do:
I have a HTML page on the local (file-)system. If it get's loaded, some JS needs to decide if a (online) address is reacheable, and load that or another local page accordingly...
I'm looking for ideas of hpw to discover if a remote URL is reacheable in JavaScript... maybe by doing some kind of
var rimg = new Image(remoteUrl);
kind of thing...
I'm open for suggestions on this.
This seems to work ok;
<html>
<head>
<title>On-/Offline Tester </title>
<script language="JavaScript" >
switchUrl =
"file:///C:/locals/index.html";
</script>
<script src="http://remote.tld/switchUrl.js"
language="JavaScript" ></script>
</head>
<body onload="location.href=switchUrl;" >
<h1>On-/Offline Tester </h1>
</body>
</htmö>
#### in the switchUrl.js ####
switchUrl = "http://remote.tld/index.html";
No, that's too easy, isn't it? the remote *.js file is CACHED by IE and others!!!
Ah, Danke Andi, so geht's:
var randNum = Math.random ();
document.write("<scr"+"ipt src=\"http://remote.tld/switchUrl.js?"+randNum"\" language=\"JavaScript\"></scri"+"pt>);
Replacing the second script tag with the static *.js URL by an dynamic' URL prevents caching nicely :)
<
[ by Martin>]
[]
[]
similar entries (vs):
- aus der Reihe: Traumwind 'stupid but entertaining PihÄhtschPih tricks'™ (# 13%)
- rss encoding... (# 10%)
- more fun than any number of wap phones in a trash-bin (# 8%)
- who ever you are.. (# 8%)
similar entries (cg):
no similar entries (yet?)
Martin Spernau
© 1994-2003
Big things to come (TM) 30th Dez 2002
Short circuit (example; a man eating peas with the idea that they will improve his virility shovels them straight into his lap)
Oblique Strategies,
Ed.3
Brian Eno and Peter Schmidt
amazon.de Wunschliste
usefull links:
powered by SBELT