Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. Refresh iframe

Refresh iframe

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
tutorialphpdatabasecomquestion
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    udch
    wrote on last edited by
    #1

    How to refresh iframe in php ? I have 4 iframe in my php and want to refresh all.Example:- <div id="l1" style="position:absolute;left:50px;top:120px;width:450px;height:140px;z-index:35" align="left"><iframe frameborder=0 src="http://ck.com/ker.php?scrip=echo $us" width=412 height=160</frame>/div>

    F 1 Reply Last reply
    0
    • U udch

      How to refresh iframe in php ? I have 4 iframe in my php and want to refresh all.Example:- <div id="l1" style="position:absolute;left:50px;top:120px;width:450px;height:140px;z-index:35" align="left"><iframe frameborder=0 src="http://ck.com/ker.php?scrip=echo $us" width=412 height=160</frame>/div>

      F Offline
      F Offline
      fly904
      wrote on last edited by
      #2

      I'm very confused. Do you want to refresh the iframe's during run-time i.e. after the page has loaded? Because I do not see how you can do that with PHP, it would have to be Javascript. The only possible time you can use PHP is before the page has loaded, in which case it would be pointless as the iframe would be loaded anyway. Everything after the page load has to be done with Javascript. Here is how to refresh the iframe in Javascript:

      document.getElementById('iframe1').contentWindow.location.reload(true);

      If at first you don't succeed, you're not Chuck Norris.

      U 2 Replies Last reply
      0
      • F fly904

        I'm very confused. Do you want to refresh the iframe's during run-time i.e. after the page has loaded? Because I do not see how you can do that with PHP, it would have to be Javascript. The only possible time you can use PHP is before the page has loaded, in which case it would be pointless as the iframe would be loaded anyway. Everything after the page load has to be done with Javascript. Here is how to refresh the iframe in Javascript:

        document.getElementById('iframe1').contentWindow.location.reload(true);

        If at first you don't succeed, you're not Chuck Norris.

        U Offline
        U Offline
        udch
        wrote on last edited by
        #3

        Thanks for your help.I want to refresh iframe after loading page and after every 1 minute.If it is not possible in php then can you tell how to insert java script function in php for refreshing iframe.If you can try to give me a very short example. Thank You

        F 1 Reply Last reply
        0
        • F fly904

          I'm very confused. Do you want to refresh the iframe's during run-time i.e. after the page has loaded? Because I do not see how you can do that with PHP, it would have to be Javascript. The only possible time you can use PHP is before the page has loaded, in which case it would be pointless as the iframe would be loaded anyway. Everything after the page load has to be done with Javascript. Here is how to refresh the iframe in Javascript:

          document.getElementById('iframe1').contentWindow.location.reload(true);

          If at first you don't succeed, you're not Chuck Norris.

          U Offline
          U Offline
          udch
          wrote on last edited by
          #4

          Can php refresh function after loading a page ?

          F 1 Reply Last reply
          0
          • U udch

            Thanks for your help.I want to refresh iframe after loading page and after every 1 minute.If it is not possible in php then can you tell how to insert java script function in php for refreshing iframe.If you can try to give me a very short example. Thank You

            F Offline
            F Offline
            fly904
            wrote on last edited by
            #5

            udch wrote:

            If it is not possible in php then can you tell how to insert java script function in php for refreshing iframe.

            Your statement shows a clear lack of understanding about how HTML, PHP and Javascript work. In the below example you can see how to use PHP with HTML correctly. You can see that the HTML tags are not written in PHP. The only part of this page that is affected by PHP is the body which will have 'Hello World!!' written in it. Also see how the Javascript is in the <script></script> tags. Make sure you give the type of the script block which in this case will be text/javascript. Your Javascript functions will now go in the script tags, as shown. Notice that in the function refreshIframes() there is a setTimeout() function which calls the function given as the first parameter ('refreshIframes()' in this case) and the number of milliseconds to wait for it to call as the second parameter (60000 in this case [60 seconds]). Please also note that onload="refreshIframes()" is in the body tag, this calls the refreshIframes() function once the page has loaded.

            <html>
            <head>
            <title>Hello World</title>
            <script type="text/javascript">
            function refreshIframes()
            {

                      //THE CODE I GAVE YOU EARLIER WILL GO HERE!
            
                      setTimeout('refreshIframes()', 60000);
                  }
              </script>
            

            </head>
            <body onload="refreshIframes()">

               <?
                   echo 'Hello world!!';
               ?>
            
               <!-- INSERT IFRAME HERE! -->
            

            </body>
            </html>

            If at first you don't succeed, you're not Chuck Norris.

            1 Reply Last reply
            0
            • U udch

              Can php refresh function after loading a page ?

              F Offline
              F Offline
              fly904
              wrote on last edited by
              #6

              No.

              If at first you don't succeed, you're not Chuck Norris.

              U 1 Reply Last reply
              0
              • F fly904

                No.

                If at first you don't succeed, you're not Chuck Norris.

                U Offline
                U Offline
                udch
                wrote on last edited by
                #7

                Thanks for you help brother

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups