How to pass results from the opened window to the openning window in JavaScript?

Posted on In QA

From the opening window by JavaScript window.open(), we can pass info to the opened by hash. But how to pass results back from the opened window to the openning window in JavaScript?

Assume in the opener window, a JavaScript variable is defined like

var exchangeVar = '';

In the opened window, you can update the exchangeVar in JavaScript by

opener.window.exchangeVar = 'updated value';

With this method, you can pass information from the opener window to the opened window and from the opened window to the opener window.

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *