By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,574 Members | 1,205 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,574 IT Pros & Developers. It's quick & easy.

Alternative to http meta refresh

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
> 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.