471,874 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,874 software developers and data experts.

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 2805
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>
  5. <iframe name = 'frame1' src="iframe_inside.php" width="500" height="500">
  6. </iframe>
We can refer to the first page as (Opener)

Expand|Select|Wrap|Line Numbers
  1. <input type='button' value='refresh Iframe' onclick="window.opener.frames['frame1'].location.reload(true);">
  3. <input type='button' value='close window' onclick="window.close();">
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 zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.