Jump to content

Problem with window.open()


Harryk89
 Share

Recommended Posts

I have a game in Pixi.js v8 and a button with a handler that opens a site in a new tab. But mobile browsers see this as a popup and block the site from opening. How to get around this?

Quote
this.faqButton.on("pointerdown", () => {
            window.open("https://github.com/pixijs/open-games", "_blank");
        });

and tried this

Quote
this.faqButton.on("pointerdown", () => {
            const link = document.createElement('a');
            link.href = 'https://github.com/pixijs/open-games';
            link.target = '_blank';
            link.rel = 'noopener noreferrer';
            link.style.display = 'none';
            document.body.appendChild(link);
           
            link.click();
        });

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...