Reputation: 31
I am opening a popup window (JSP page) using JavaScript.
I am setting some value in the popup and doing window.close()
.
Now, I am to return that value to the main page from where I had opened the popup through JavaScript.
How can I retrieve the value?
Upvotes: 3
Views: 2197
Reputation: 43013
In your jsp page add this :
function onPopupClose(returnParameter) {
// Process returnParameter here
}
window.open('popup.jsp?parameter='+param,'mywindow','width=500,height=350,toolbar=no,resizable=no,menubar=no');
Then in your popup jsp, before calling window.close
, add this line :
window.opener.onPopupClose(myValue);//myValue is the value you want to return to main javascript
window.close();
Upvotes: 1