Redirect user to website

Hi! Can you help me? I’m working on a game where I need to attach a function to an object to redirect the user to a given URL. I’m using TypeScript for the game. Is it possible to do this and how? Thanks.

can it work if replace  text with link?

GUI.HUD.showInfoPanel({ 
   title: 'This is the title',
    image: 'yourImageID',
    text: 'This is the body text.',
    onHide: () => Debug.log('Panel closed.'),
})

Did you try this way? It doesn’t work for me.

I don’t believe this is currently possible via Typescript. Please add the tag feature-request to your topic and tag in @CoSpaces_Edu so they can pass this request on to the developers for consideration.

1 Like

Thanks! This has been passed on to our devs as a feature request :slight_smile:

i found sth like this :

this:
const btn = Scene.createItem(‘LP_Cube’, 0, 0, 0);

btn.onActivate(() => {
open(‘https://www.youtube.com/watch?v=dQw4w9WgXcQ’, ‘_blank’);
});
and this:
image

Grabbing random Typescript (TS) code from websites and pasting it into CoSpaces will generally not work @HenryHuy - especially those that rely on the Navigator and Window objects, which are not available in CoSpaces.

To find out whether an object is available, start typing the name of the object in the CoSpaces TS editor - if it doesn’t appear, it probably isn’t available.

they can add few scripts to open link in next update?

1 Like