Search code examples
htmlrefreshframeset

Refresh Frameset


I have a site with a frame:

<frameset cols="69%,31%">
  <frame src="main.php" />
  <frame src="result.html" />
</frameset>

Its looks like this:

------------|-----------
            |
search      | result1
            | result2
            | result3
            |
            |
            |
            |
------------|---------

Here is how it workrs (it is much more complex)

Main.php (left frame) uses a search (like a search engine) result.html (right frame) , only reads what main.php founds, so:

What I want to do is refresh result.html from main.php. How can I do this???

NOTE: I do not want to autorefresh result.html (right frame) with AJAX timer or something. The refresh must be triggered by main.php (left frame)


Solution

  • If you add a JavaScript function into the page that holds the two frames you can accomplish this.

    In the parent page:

    refreshResults = function () {
        resultFrame.location.reload();
    }
    

    and then call it from main.php like this:

    parent.refreshResults ();