Web Analytics Made Easy -
StatCounter refresh iframe - CodingForum

Announcement

Collapse
No announcement yet.

refresh iframe

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • refresh iframe

    hi ,

    i have iframe on my web page which shows the web camera .
    I want that iframe should refresh every 5 seconds.

    Can anyone help me

  • #2
    You need javascript to achieve this put this in your head

    Code:
    <script type="text/javascript">
     function reloadiframe () {
        setTimeout("go_now()",5000);
        }
    
        function go_now () {
            
        parent.frames['myiframe'].location.reload(true);
        }
    </script>
    make sure your iframe has name="myiframe"

    Code:
    <iframe src="http://example.com" name = "myiframe" onLoad="reloadiframe();">
    Though the onload is supported in most current browsers (IE5.5+, Firefox, Safari, Opera) it's not actually correct. Not sure of a better way though. Also this script will only work if both your parent document and iframe document are hosted on the same domain?

    If its not on same domain there's some information of what to do here http://www.dyn-web.com/tutorials/iframes/
    Last edited by timgolding; Apr 6, 2009, 05:00 AM.
    You can not say you know how to do something, until you can teach it to someone else.

    Comment


    • #3
      why don't you just add this in the iframe window:

      Code:
      <meta http-equiv="REFRESH" content="5;url=theurltoyouriframe">

      Comment

      Working...
      X