Alternative to http meta refresh

J

Jarson

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
 
R

Randy Webb

Jarson said:
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.
 
R

Robert

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=en&lr=&ie=UTF-8&[email protected]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top