469,626 Members | 996 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

Alternative to http meta refresh

My webserver hosts some on-line reports with live data. I have put an html
meta tag to force the client to refresh every 10 minutes so my clients will
always show the latest data ..

<meta http-equiv="Refresh" content="600" />

However, once or twice every day my IP address changes or my WAN link may be
inaccessible for a couple of minutes. If the client refresh occurs during
the period that my host is down or DNS entry is updating then the refresh
will result in an error.

Is there a way to replace this will a small Javascript in each page to first
check if my site is available, and only then refresh the page? I'm just
learning JavaScript, so any code tidbits would be greatly appreciated.

Jarson
Jul 23 '05 #1
2 8181
Jarson wrote:
My webserver hosts some on-line reports with live data. I have put an html
meta tag to force the client to refresh every 10 minutes so my clients will
always show the latest data ..

<meta http-equiv="Refresh" content="600" />
In IE6
Tools>Internet Options>Security Tab, Custom Level.
Uncheck the "Allow Meta Refreshes"

My point is that Meta Refreshes are as simple to disable as javascript is.
However, once or twice every day my IP address changes or my WAN link may be
inaccessible for a couple of minutes. If the client refresh occurs during
the period that my host is down or DNS entry is updating then the refresh
will result in an error. Is there a way to replace this will a small Javascript in each page to first
check if my site is available, and only then refresh the page? I'm just
learning JavaScript, so any code tidbits would be greatly appreciated.


Try loading an image from your server, check its onError and onLoad to
see if it loads. If it doesn't load, try it with the second server.
Search the archives for ways to accomplish that.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
> Try loading an image from your server, check its onError and onLoad to
see if it loads. If it doesn't load, try it with the second server.
Search the archives for ways to accomplish that.


This will let you know the server is around.

To get data, one possibility is to use a hidden iframe. What you do
is periodically load the iframe. Have the iframe invoke some
javascript in the onload handler. Have the javascript refresh the
page.

Here is a more detail write up:

http://groups.google.com/groups?hl=e...news.xs4all.nl

From: Erwin Moller
Subject: Re: calling Perl script from javascript
Newsgroups: comp.lang.javascript

Another alternative is to use an xml HTTP request. See:

http://jibbering.com/2002/4/httprequest.html

I'd try to find a week long course on advanced web programming that
covers this stuff and convince your boss you need to attend.
Robert
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

43 posts views Thread by dan baker | last post: by
1 post views Thread by Chumley Walrus | last post: by
3 posts views Thread by George Durzi | last post: by
4 posts views Thread by aaa | last post: by
5 posts views Thread by chortler | last post: by
2 posts views Thread by =?Utf-8?B?UGhpbCBKb2huc29u?= | last post: by
2 posts views Thread by runway27 | last post: by
41 posts views Thread by Twayne | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.