Refreshing an IFrame inside an external browser window

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bnashenas1984
    Contributor
    • Sep 2007
    • 257

    Refreshing an IFrame inside an external browser window

    Hi everyone
    I'v seen several websites doing what I'm asking now but I don't know how they do it.

    Lets say we have an E-commerce website that has a shopping cart inside an IFrame which shows what products have been added.

    Users should be able to add comments for each product inside the shopping cart (in the Iframe) .

    When the user clicks on the product a new popup window opens which allows him to add the comment and then save.
    But how can I refresh the IFrame after the user has saved the comment inside the external window?

    I know there are other ways to do this.. Like refreshing the Iframe each X second but I don't think this is the logical way.

    I need to do exactly what I described. refreshing an IFrame inside an external browser window.

    Any suggestions will be highly appreciated

    Thanks / Behzad
  • bnashenas1984
    Contributor
    • Sep 2007
    • 257

    #2
    re: refreshing an iframe inside an external browser window

    Hi again
    Finally I found an answer to my question.
    I post it here for others who might have the same problem.

    This is possible to refresh the OPENER window using JavaScript.

    Here is what I did :

    Lets say we have a page with an IFrame in it

    Code:
    <a href="javascript:window.open('popup.php','terms',' width=400, height=260, left=200, top=200');void('');">
    Open popup window
    </a>
    
    <iframe name = 'frame1' src="iframe_inside.php" width="500" height="500">
    </iframe>
    We can refer to the first page as (Opener)

    popup.php
    Code:
    <input type='button' value='refresh Iframe' onclick="window.opener.frames['frame1'].location.reload(true);">
    
    <input type='button' value='close window' onclick="window.close();">
    Hope it helps

    Comment

    Working...