Whenever I try to open a URL with window.open()
, no window is opened. So I tried this
<input
id="googleLink"
onclick="window.open('https://www.google.com', '_blank');"
style="display: none"
>
And I tried to click it with Typescript
this.googleLink = document.getElementById("googleLink") as HTMLElement;
this.googleLink.click();
And read this
window.open(url, '_blank'); not working on iMac/Safari
But none of it helps. I am not running my code in an async function. What can I do? I have an iPhone 11 and 7 and on both, it does not work. It works just fine on android and pc. I need the URL to be opened in a new window.
I need to do this with the onClick
since I am using pixi js and it is a pixi container that is being clicked.
Setting the href won't help either because I want the page to open in a new tab.