468,771 Members | 1,658 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,771 developers. It's quick & easy.

Refreshing an IFrame inside an external browser window

258 100+
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
Nov 23 '09 #1
1 2687
bnashenas1984
258 100+
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

Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:window.open('popup.php','terms',' width=400, height=260, left=200, top=200');void('');">
  2. Open popup window
  3. </a>
  4.  
  5. <iframe name = 'frame1' src="iframe_inside.php" width="500" height="500">
  6. </iframe>
  7.  
We can refer to the first page as (Opener)

popup.php
Expand|Select|Wrap|Line Numbers
  1. <input type='button' value='refresh Iframe' onclick="window.opener.frames['frame1'].location.reload(true);">
  2.  
  3. <input type='button' value='close window' onclick="window.close();">
  4.  
Hope it helps
Nov 23 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Venkatesh | last post: by
7 posts views Thread by nicknack | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.