Window to window Communication in js by window name

Is there anyone who can give me some thoughts on how to handle window-to-window communication using javascript givin, that the two windows do not have parent child relations. Basically, another window is opened using the window.open method. Any brilliant information is well appreciated.

+3
source share
1 answer

assuming the following:

windowHandle=window.open('path/to/document');

You can interact between both windows.

You have a pointer to a window object from the document in which it was opened using the variable name:

//doSomething has to be known inside the new window
windowHandle.doSomething();

and from the document in a new window to a window opening a new window using opener-property:

//doSomething has to be known inside the window that opened the new window
opener.doSomething();
+8

Source: https://habr.com/ru/post/1622583/


All Articles