andrei.nicolae Posted September 17, 2018 Share Posted September 17, 2018 Hi guys, I've tried multiple solutions found online opening a new tab when a button is hit. buyBtn.on('pointerdown', function (event){ openWindow(myurl); }, this); function openWindow(url) { var result = window.open(url, "_blank") } function openWindow(url) { document.getElementById('newlink').href = url; document.getElementById('newlink').click(); } function openWindow(url) { window.location.assign(url); } This are some of them. All of these solutions work on other browsers, but not on Safari. Does anyone have a working solution for Phaser3? Thank you. Link to comment Share on other sites More sharing options...
rich Posted September 17, 2018 Share Posted September 17, 2018 Like this: http://labs.phaser.io/view.html?src=src\input\dom events\add up callback.js It needs specific handling so that the callback is executed in the event handler. Look at the docs for this.input.addUpCallback because they're extensive and explain how to use it and what to look out for. andrei.nicolae 1 Link to comment Share on other sites More sharing options...
andrei.nicolae Posted September 18, 2018 Author Share Posted September 18, 2018 14 hours ago, rich said: Like this: http://labs.phaser.io/view.html?src=src\input\dom events\add up callback.js It needs specific handling so that the callback is executed in the event handler. Look at the docs for this.input.addUpCallback because they're extensive and explain how to use it and what to look out for. Thanks for the solution. Works like a charm, for future users that have this problem, add a callback inside the button touch/click event. Link to comment Share on other sites More sharing options...
visuallization Posted November 11, 2020 Share Posted November 11, 2020 If anyone comes over this: add_up_callback was apparently removed. But you can still make it work by adding a `pointerup` callback instead of a `pointerdown` callback. So you can do something like this: button.on('pointerup', () => { window.open('http://example.com'); }); Link to comment Share on other sites More sharing options...
Recommended Posts