By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,689 Members | 1,915 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,689 IT Pros & Developers. It's quick & easy.

Refreshing an IFrame inside an external browser window

100+
P: 258
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
Share this Question
Share on Google+
1 Reply


100+
P: 258
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.