
window.open API returns null although the browser is launched.
I'm trying to check the result of "window.open" API. This is my code:
const result = window.open(link, "_blank");
if (!result) {
throw new Error ("Failed to open the link window");
}
It works well when the code runs in the browser. Most of time, window.open will return the object. It returns null when there is a pop-up blocker.
But when it runs in the WebView of Window Desktop, it would always return null although launch the browser tab successfully.
I have two questions:
Firstly, I want to confirm is this some similar bug in Edge like https://bugzilla.mozilla.org/show_bug.cgi?id=1466347#c4.
Secondly, is there any other way that I could check whether the browser have been opened?
Any solution or suggestions would be appreciated! Thanks!