Button Go to URL

Hi,

I am new here.

I am hoping to make a simple 2D button from the UI that when click will go to a URL webpage.

Is that possible ?

Thank You

Hi @Syam_Fz and welcome,

Check this thread: Link as Text element

Hi @Leonidas,

Thank you. This work very well on my computer.

What I am trying to do is on phone with below script.

var Tolink = pc.createScript(‘tolink’);

// initialize code called once per entity
Tolink.prototype.initialize = function() {

this.entity.element.on('touchstart', function(){
    var win = window.open('https://www.instagram.com/ar/701230827437789/?ch=MzQwNTZlOTNiMTZlODI1Yjg4YzQ0ZGE2ZTEyZTBiNTY%3D', '_blank');
    win.focus();
}, this);

};

But it open on chrome. Is there a way to open it in instagram application on phone ?

Thank You

Hi @Syam_Fz,

I don’t think so, you can only open new windows in the same browser your playcanvas app is running on.

It depends on how the user has set up their phone. Some may have links open in apps and some may not.

I see, Thanks

But, how are others doing the open link and then the user can choose to open with which app ?

Or is there an external software for it ?