views:

40

answers:

1

Hello Experts,

I have a question on javascript window management.

My application opens an iframe which displays a link. Clicking on the link, opens a popup window, in which I enter my login credentials. My intention is to close the popup window after the login credentials are entered. And this I have been able to achieve using a JS call to self.close().

There after my server side script does some more processing and would like to display the results back in the iframe. This is where things break for me.

The overall flow is as follows: Iframe Displays a Link --> Clicking on the Link Pops up a window --> Popup Window closes after credentials are entered --> I see my original iframe now (How do I display the contents back in the iframe). Here is the code snippet that closes the popup.

5 6 self.close(); 7

The parent of the popup is the iframe. If I modify the above script to give the focus back to its parent, which in my case will be the iframe, will that suffice? Or am I issing something here?

+1  A: 

you can access the iframe from your popup by using opener. for example this will reload your iframe:

<script type="text/javascript">
 opener.location.href = "htp://mypage.com/myiframe.php";
</script>

you just have to add the right parameters to show what you want to. (of course you have to do this before your self.close();)

oezi