You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to open a new tab via a 'pointerup' event (or any pointer event) in Phaser will result in Chrome's popup blocker being triggered. The same action done via a document.addEventListener('mouseup', myFunction) event won't trigger Chrome's popup blocker. This means I can't add in-game buttons that do things such as redirect a user to my website unless they explicitly allow popups.
Example Test Code
var config = {
type: Phaser.AUTO,
width: 400,
height: 300,
backgroundColor: '#111111',
parent: 'phaser-example',
scene: {
preload: preload,
create: create
}
};
var game = new Phaser.Game(config);
function preload ()
{
this.load.image('button', 'button.png');
}
function create ()
{
var myButton = this.add.image(200, 150, 'button');
myButton.setInteractive();
// clicking on the button will trigger Chrome's popup blocker instead of going to google.com
myButton.on('pointerup', () => {window.open('https://www.google.com')}, this);
}
Using document.addEventListener to trigger window.open() will open the new tab at Google without fuss, but of course this means clicking anywhere in the game will cause the new tab to open.
Description
Trying to open a new tab via a 'pointerup' event (or any pointer event) in Phaser will result in Chrome's popup blocker being triggered. The same action done via a document.addEventListener('mouseup', myFunction) event won't trigger Chrome's popup blocker. This means I can't add in-game buttons that do things such as redirect a user to my website unless they explicitly allow popups.
Example Test Code
Using document.addEventListener to trigger window.open() will open the new tab at Google without fuss, but of course this means clicking anywhere in the game will cause the new tab to open.
Additional Information
The text was updated successfully, but these errors were encountered: