How do I refresh a page automatically

Discussion in 'HTML' started by Gram, Feb 6, 2004.

  1. Gram

    Gram Guest

    Is there another way to automatically refresh or reload a page, other than
    using a meta refresh?
    Gram, Feb 6, 2004
    #1
    1. Advertising

  2. Gram

    Kris Guest

    In article <HlLUb.1652$>,
    "Gram" <> wrote:

    > Is there another way to automatically refresh or reload a page, other than
    > using a meta refresh?


    Explain the situation and we may be able to supply you with a good
    solution.

    --
    Kris
    <> (nl)
    <http://www.cinnamon.nl/>
    Kris, Feb 6, 2004
    #2
    1. Advertising

  3. Gram

    Gram Guest

    I have a chat room made with ASP ( I know, there are better ways to do this)
    and I am using an iframe to display the conversation text so far. So I have
    a meta refresh to keep reloading the text at a regular interval, however, I
    also have an anchor tag at the end of the text, so it will automatically
    scroll to the bottom, but the meta refresh doesn't woork with the extra
    #bottom bit.

    <META HTTP-EQUIV='REFRESH' CONTENT='30;URL=conversation.asp#bottom'>

    Any thoughts?
    Gram, Feb 6, 2004
    #3
  4. Gram

    mscir Guest

    Gram wrote:

    > I have a chat room made with ASP ( I know, there are better ways to do this)
    > and I am using an iframe to display the conversation text so far. So I have
    > a meta refresh to keep reloading the text at a regular interval, however, I
    > also have an anchor tag at the end of the text, so it will automatically
    > scroll to the bottom, but the meta refresh doesn't woork with the extra
    > #bottom bit.
    >
    > <META HTTP-EQUIV='REFRESH' CONTENT='30;URL=conversation.asp#bottom'>
    >
    > Any thoughts?


    Maybe try using Javascript to refresh the page.

    this page has the iframe:

    <html>
    <head>
    <script language="JavaScript" type="text/javascript">
    function msgRefresh () {
    window.frames['iframe1'].location = "2.html#bottom";
    window.setTimeout('msgRefresh()',2000);
    }
    </script>
    </head>

    <body onload='msgRefresh()'>
    test
    <hr>
    <iframe height="650" width="600" src="2.html" name="iframe1"
    scrolling="yes">This browser does not support...</iframe>
    <hr>
    test
    </body>
    </html>



    2.html, the page loaded into the iframe, includes:

    <a name="bottom">&nbsp</a>

    It seems to work on my ie6 and netscape 7.1

    MIke
    mscir, Feb 6, 2004
    #4
  5. Gram

    Gram Guest

    Thanks for the help Mike.

    It seems to work grand refreshing the page, however it doesn't seem the like
    the anchor (#bottom) part. When I have this part in, I can see the browser
    try to reload, but the iframe doesn't change.
    When I remove the #bottom, it works perfect, with out the scrolling of
    course. Is there any way to keep them independant? to get a seperate
    function to scroll it to the bottom?

    Also, any ideas why a sumbit button doesn't sumbit when hitting the return
    key?

    Again, Thanks for the help,

    Gram.

    "mscir" <> wrote in message
    news:...
    >
    >
    > Gram wrote:
    >
    > > I have a chat room made with ASP ( I know, there are better ways to do

    this)
    > > and I am using an iframe to display the conversation text so far. So I

    have
    > > a meta refresh to keep reloading the text at a regular interval,

    however, I
    > > also have an anchor tag at the end of the text, so it will automatically
    > > scroll to the bottom, but the meta refresh doesn't woork with the extra
    > > #bottom bit.
    > >
    > > <META HTTP-EQUIV='REFRESH' CONTENT='30;URL=conversation.asp#bottom'>
    > >
    > > Any thoughts?

    >
    > Maybe try using Javascript to refresh the page.
    >
    > this page has the iframe:
    >
    > <html>
    > <head>
    > <script language="JavaScript" type="text/javascript">
    > function msgRefresh () {
    > window.frames['iframe1'].location = "2.html#bottom";
    > window.setTimeout('msgRefresh()',2000);
    > }
    > </script>
    > </head>
    >
    > <body onload='msgRefresh()'>
    > test
    > <hr>
    > <iframe height="650" width="600" src="2.html" name="iframe1"
    > scrolling="yes">This browser does not support...</iframe>
    > <hr>
    > test
    > </body>
    > </html>
    >
    >
    >
    > 2.html, the page loaded into the iframe, includes:
    >
    > <a name="bottom">&nbsp</a>
    >
    > It seems to work on my ie6 and netscape 7.1
    >
    > MIke
    >
    Gram, Feb 6, 2004
    #5
  6. Gram

    mscir Guest

    Gram wrote:
    > Thanks for the help Mike.
    >
    > It seems to work grand refreshing the page, however it doesn't seem the like
    > the anchor (#bottom) part. When I have this part in, I can see the browser
    > try to reload, but the iframe doesn't change.
    > When I remove the #bottom, it works perfect, with out the scrolling of
    > course. Is there any way to keep them independant? to get a seperate
    > function to scroll it to the bottom?
    >
    > Also, any ideas why a sumbit button doesn't sumbit when hitting the return
    > key?
    >


    How does this work?

    <html>
    <head>
    <script type="text/javascript">
    var milliSecondsToWait = 2000;
    function reloadIFrame(){
    window.frames['iframe1'].location = "2.html?" + (new Date().getTime());
    window.frames['iframe1'].location.hash="#bottom"
    myVar = setTimeout("reloadIFrame()",milliSecondsToWait);
    }
    var myVar = setTimeout("reloadIFrame()",milliSecondsToWait);
    </script>
    </head>

    <body onload='reloadIFrame()'>
    test
    <p>&nbsp;
    <iframe height="450" width="600" src="2.html" name="iframe1"
    scrolling="yes">This browser does not support...</iframe>
    <p>&nbsp;
    test
    </body>
    </html>
    mscir, Feb 6, 2004
    #6
  7. Gram

    mscir Guest

    > How does this work?
    >
    > <html>
    > <head>
    > <script type="text/javascript">
    > var milliSecondsToWait = 2000;
    > function reloadIFrame(){
    > window.frames['iframe1'].location = "2.html?" + (new Date().getTime());
    > window.frames['iframe1'].location.hash="#bottom"
    > myVar = setTimeout("reloadIFrame()",milliSecondsToWait);
    > }
    > var myVar = setTimeout("reloadIFrame()",milliSecondsToWait);
    > </script>
    > </head>
    >
    > <body onload='reloadIFrame()'>
    > test
    > <p>&nbsp;
    > <iframe height="450" width="600" src="2.html" name="iframe1"
    > scrolling="yes">This browser does not support...</iframe>
    > <p>&nbsp;
    > test
    > </body>
    > </html>


    Sorry, I made a mistake in the script cutting & pasting, should be:

    <script type="text/javascript">
    var milliSecondsToWait = 5000;
    function reloadIFrame(){
    window.frames['iframe1'].location = "2.html?" + (new Date().getTime());
    window.frames['iframe1'].location.hash="#bottom"
    myVar = setTimeout("reloadIFrame()",milliSecondsToWait);
    }
    </script>
    mscir, Feb 6, 2004
    #7
  8. Gram

    mscir Guest

    Gram, here's a simpler approach, don't know why I didn't think of it sooner:

    in the <head> section of your page being loaded into the iframe:

    <META HTTP-EQUIV='REFRESH' CONTENT='3; URL='4.htm';>
    <script type="text/javascript">
    function gotoanchor() {
    this.location.hash='#bottom';
    }
    </script>
    </head>


    in the <body> section call the function:

    <body onload="gotoanchor();">

    Does this do it?
    Mike
    mscir, Feb 7, 2004
    #8
  9. Gram

    Gram Guest

    Thanks for all the help guys, I'll put it all into action shortly.
    I'll be back if there are any problems. :0)

    "mscir" <> wrote in message
    news:...
    > Gram, here's a simpler approach, don't know why I didn't think of it

    sooner:
    >
    > in the <head> section of your page being loaded into the iframe:
    >
    > <META HTTP-EQUIV='REFRESH' CONTENT='3; URL='4.htm';>
    > <script type="text/javascript">
    > function gotoanchor() {
    > this.location.hash='#bottom';
    > }
    > </script>
    > </head>
    >
    >
    > in the <body> section call the function:
    >
    > <body onload="gotoanchor();">
    >
    > Does this do it?
    > Mike
    >
    Gram, Feb 7, 2004
    #9
    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. john
    Replies:
    4
    Views:
    5,021
    Curt_C [MVP]
    Jan 30, 2004
  2. me
    Replies:
    7
    Views:
    658
  3. Replies:
    2
    Views:
    7,161
  4. Harry Bellafonte
    Replies:
    0
    Views:
    398
    Harry Bellafonte
    Nov 8, 2007
  5. Pkenty
    Replies:
    0
    Views:
    389
    Pkenty
    May 28, 2004
Loading...

Share This Page