Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass data back to parent window?

I found a link that shows how to send parameters back to the opener browser window. But it works only with window.showmodal(). There should be an easy way to do the same if I use window.open() right?

like image 530
David Israel Avatar asked Feb 11 '13 01:02

David Israel


People also ask

How do I transfer data from child window to parent window?

From a child window or a small window once opened, we can transfer any user entered value to main or parent window by using JavaScript. You can see the demo of this here. Here the parent window is known as opener. So the value we enter in a child window we can pass to main by using opener.

How do I get a return value from a Windows Open?

returnValue = true; window. close();

How do you refresh the parent window in closing the child?

In the HTML markup of the Child page we need to place the JavaScript function RefreshParent which is called attached to the browser onbeforeunload event. Thus when the Child page popup window is closed the parent page is refreshed.


1 Answers

If you are using window.open, you can call a function in the parent window and pass in pararmeters to that function.

Do this in child page javascript

var x="hello";//parameter I want to pass to the parent
window.opener.ParentPageFunctionName(x);
like image 92
developer747 Avatar answered Sep 28 '22 17:09

developer747