Iframe Refresh

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nigel Wroe

    Iframe Refresh

    I am using a shoutbox cgi and the messages are written to a file called
    tagbox.html using a form.

    After so many messages the file is blanked and new lines are written.

    I can cause a refesh say every 20 seconds by embedding a meta tag in the
    tagbox.html thus:

    <META HTTP-EQUIV="refresh" content="20">

    However this gets blanked out along with all the other message lines.

    tagbox.html is called into an iframe via a cgi script.

    I need a form of javascript to embed into the cgi script such that
    tagbox.html will be refreshed.

    Any ideas? Thanks.


  • Randy Webb

    #2
    Re: Iframe Refresh

    Nigel Wroe wrote:[color=blue]
    > I am using a shoutbox cgi and the messages are written to a file called
    > tagbox.html using a form.
    >
    > After so many messages the file is blanked and new lines are written.
    >
    > I can cause a refesh say every 20 seconds by embedding a meta tag in the
    > tagbox.html thus:
    >
    > <META HTTP-EQUIV="refresh" content="20">
    >
    > However this gets blanked out along with all the other message lines.
    >
    > tagbox.html is called into an iframe via a cgi script.
    >
    > I need a form of javascript to embed into the cgi script such that
    > tagbox.html will be refreshed.
    >
    > Any ideas? Thanks.
    >
    >[/color]

    In your main page:

    <script type="text/javascript">

    var milliSecondsToW ait = 20000;

    function reloadIFrame(){
    document.frames['iFrameName'].location.href =
    "tagbox.htm l?" + (new Date().getTime( ));
    myVar = setTimeout("rel oadIFrame()",mi lliSecondsToWai t);
    }
    var myVar = setTimeout("rel oadIFrame()",mi lliSecondsToWai t);

    </script>

    <iframe id="iFrameName " src="tagbox.htm l"></iframe>

    The ?(new Date().getTime( )) is to make the URL unique and keep the file
    from being gotten from the cache.

    Enjoy

    --
    Randy

    Comment

    • Nigel Wroe

      #3
      Re: Iframe Refresh

      Thanks,

      That works a treat!



      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • mscir

        #4
        Re: Iframe Refresh

        Randy Webb wrote:
        [color=blue]
        > In your main page:
        >
        > <script type="text/javascript">
        > var milliSecondsToW ait = 20000;
        > function reloadIFrame(){
        > document.frames['iFrameName'].location.href =
        > "tagbox.htm l?" + (new Date().getTime( ));
        > myVar = setTimeout("rel oadIFrame()",mi lliSecondsToWai t);
        > }
        > var myVar = setTimeout("rel oadIFrame()",mi lliSecondsToWai t);
        > </script>
        >
        > <iframe id="iFrameName " src="tagbox.htm l"></iframe>[/color]


        Randy,

        I'm using your code to refresh a page in an iframe and jump to an anchor
        placed at the bottom of the iframe page.

        <html>

        <head>
        <script type="text/javascript">
        var milliSecondsToW ait = 5000;
        function reloadIFrame(){
        //document.frames['iFrame1'].location.href ="2.html?" + (new
        Date().getTime( ));
        window.frames['iframe1'].location = "2.html?" + (new Date().getTime( ));
        window.frames['iframe1'].location.hash= "#bottom"
        myVar = setTimeout("rel oadIFrame()",mi lliSecondsToWai t);
        }
        var myVar = setTimeout("rel oadIFrame()",mi lliSecondsToWai t);
        </script>
        </head>

        <body onload='reloadI Frame()'>
        test
        <p>&nbsp;
        <iframe height="450" width="600" src="2.html#bot tom" name="iframe1"
        scrolling="yes" >This browser does not support...</iframe>
        <p>&nbsp;
        test
        <form method="POST" action="--WEBBOT-SELF--">
        <p>
        <input type="text" name="T1" size="20">
        <input type="button" value="Button" name="B3">
        <input type="submit" value="Submit" name="B1">
        <input type="reset" value="Reset" name="B2"></p>
        </form>
        </body>
        </html>


        It works, but it also scrolls the page with the inserted iframe to the
        bottom! Any suggestions on how I can jump to the bottom of the iframe only?

        Nice code, thanks,
        Mike

        Comment

        Working...