Alternative to http meta refresh

Discussion in 'Javascript' started by Jarson, Aug 12, 2004.

  1. Jarson

    Jarson Guest

    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
     
    Jarson, Aug 12, 2004
    #1
    1. Advertising

  2. Jarson

    Randy Webb Guest

    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
     
    Randy Webb, Aug 12, 2004
    #2
    1. Advertising

  3. Jarson

    Robert Guest

    > 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&selm=41160490$0$34762$4all.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
     
    Robert, Aug 13, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?bWc=?=

    META HTTP-EQUIV="Refresh"

    =?Utf-8?B?bWc=?=, Jun 30, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    592
    Teemu Keiski
    Jun 30, 2004
  2. Chumley Walrus
    Replies:
    1
    Views:
    959
    Joerg Jooss
    Mar 5, 2005
  3. George Durzi
    Replies:
    3
    Views:
    4,854
    George Durzi
    Apr 28, 2005
  4. Replies:
    5
    Views:
    3,506
  5. Nym Pseudo

    META NAME and META HTTP-EQUIV

    Nym Pseudo, Sep 26, 2003, in forum: HTML
    Replies:
    1
    Views:
    593
    =?iso-8859-1?Q?brucie?=
    Sep 26, 2003
Loading...

Share This Page