Sign in to follow this  
Ninjadoodle

Open link in new window?

Recommended Posts

Mobile browsers usually require that you call window.open on touch event, otherwise it will be blocked.

On native app, it might require plugin.

Try it on touch event and let me know how it works.

Share this post


Link to post
Share on other sites

@enpu

Oh ok, sorry I misunderstood. In that case, I'm already doing this ...

game.scene.buttonFacebook = new game.Sprite('buttonFacebook.png');

game.scene.buttonFacebook.position.set(416, 736);
game.scene.buttonFacebook.anchorCenter();
game.scene.buttonFacebook.interactive = true;
game.scene.buttonFacebook.addTo(game.scene.ib);

game.scene.buttonFacebook.mousedown = function() {
    window.open('https://www.panda2.io');
};

 

Share this post


Link to post
Share on other sites

@Ninjadoodle

Your code sure is correct. Mobile Safari seems to block all pop-ups by default, that can be changed from settings.

You can also just change the url with

window.location.href = 'https://www.panda2.io';

Though that will change the url of the current browser window, meaning it will completely exit your game. But that code should work anywhere, not just at interactive function.

I just fixed window.open to work on the editor, will be on next release.

Also need to make changes to Panda Remote so it works there too, and when exporting as native app.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.