Link as Text element

When the user clicks on the text element, I need to open up a new website
The problem is I can’t do this with HTML/CSS elements, It has to be text from PlayCanvas
Is there any way to do that?

I tried this code, but it’s not working :slight_smile:

Hi @Dava,

Your code is correct, you just need to add it as a response to a click or touch handler. On a script that is attached to your element entity, and make sure you have Use Input enabled in the element component:

this.entity.element.on('mouseup', function(){
   var win ='', '_blank');
}, this);

The problem is, it only adds URL on playcanvas existing URL, like in the picture

Grabbed one of the UI samples to give it a try, seems to be working fine. Check it here:

1 Like

It is not working anymore

I faced the same problem, but found a solution here:

The problem is, that e.g. “” is interpreted as a relative url and therefore appended to the current url. When using “” it works as expected.