I need to exchange messages with the popup, opened by code, via MessageChannel.
I open the popup window with window.open() and by default window is blocked, so the result is null. I need to check when user enables the window. Popup window is on another domain.
I tried something like this:
const popup = window.open( popupUrl, "Popup", popupWindowFeatures )
const interval = setInterval(() => {
if (popup) {
console.log('Popup is opened')
}
});
But popup is still null, so i cannot post a message to it.
How can I resolve the problem, without manual opening by click or page refresh?