'Window.open can't be closed for some urls

In my react app, I am opening a popup window like this

this.popup = window.open('https://github.com', 'Popup', newOpts);

when I try to close this popup 5 seconds later by calling close() like below

this.popup.close()

it works fine when url is 'https://github.com' or 'https://google.com' but for some other urls like 'https://twitter.com' or 'https://facebook.com' it doesn't work. Can anyone try explain this behaviour to me?



Solution 1:[1]

It turned my issue is related to twitter v2 endpoint itself since it has COOP header set. See related discussion: https://twittercommunity.com/t/oauth2-authorization-via-window-open/167249

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aamer