Reputation:
I have two windows: window A and window B.
window A and window B are active on the same Web-browser.
window A contains a script.
Questions:
Is it possible for window A to listen to events that are happening in windows B such as keyup
?
Please provide some explanation.
Upvotes: 0
Views: 3129
Reputation: 21
Window A can listen to Window B events using sockets, checkout socket.io library. Where we need to emit an event and listen across all windows or specific windows can be possible using this library.
Upvotes: 0
Reputation: 1627
In window B you set a cookie and in window A you create a setTimeout function that every "x" milliseconds check if there are any new cookie.
Look at this: Javascript communication between browser tabs/windows
Upvotes: 1
Reputation: 2010
If window A is a parent of window B (A opened B) then it's possible to find the element and add event listener. Also you can use postMessage to communticate between windows.
Upvotes: 0