How to pass data from a child popup window to the parent window in JavaScript

Practice




How to pass data from a child popup window to the parent window in JavaScript

first let me explain how to create the popup window itself, positioned exactly in the centre of the user's screen

function _open( url, width, height ) {
var val=window.open( url, '', 'width=' + width + ',height=' + height + ',left=' + ((window.innerWidth - width)/2) + ',top=' + ((window.innerHeight - height)/2)+ ', status=1' );
} // end _open function



Then
in the code for the main window we add a JavaScript function





and in the code with the popup window
you can pass or change data in the parent window through a buffer whose receiver and transmitter are functions located in the different windows

you can either close the popup or reload the parent window without closing the child one

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Scripting client side JavaScript, jqvery, BackBone"

Terms: Scripting client side JavaScript, jqvery, BackBone