tags:

views:

109

answers:

2

I am opening one Popup window on Button Click in main window, it is for Image Uploading.

when I am uploading Image , i.e. on Upload button click I am closing this Popup window and opening new Popup window.

And Now I want to display the Popup data to Parent window without refreshing, But I am not getting Parent window object.

i.e. window.opener or window.parent. Please give me help. How I will get Parent window object?

A: 

You can access the parent window by using window.opener

See window.opener

which returns a reference to the window that opened this current window. When a window is opened from another window, it maintains a reference to that first window as window.opener. If the current window has no opener, this method returns NULL.

rahul
it is giving null value. how to get the value of Parent window
Pranjali
A: 

you can try this, When first popup window is opened(uploading image window) get parent window object for this popup and store in some variable(java script variable ) like this var parentWindowObject=window.opener; Try passing this object variable to the second pop up window( on upload click) and in this page you will get it main page window reference (parentWindowObject) and using this you can fire new request to main page to post your required data as follows parentWindowObject.location="your request";

Reason for not using window.opener in second popup As you are opening a new popup from the present popup. The parent for the newpopup will be the popup which you are opening from here is your upload popup and you are closing the upload popup once you click on upload so for the new popup the value for window.opener(a reference for the parent window) will be null.

I solved this problem with opening both pages in one popup only so I am getting parent window object. I have opened 2 popups because I want size of both the windows different, but I have Resized the popup window on execution of another Page. Thanks for Help.
Pranjali