Opening a url in a browser tab only works in the editor

Hi

In our game we have the functionality to click on Links in the UI and they open in a new browser tab.
This works great when we test the game via the launch button of the editor.
However if I publish the game and upload it to our own server the code throws an exception saying

TypeError: Cannot read properties of undefined (reading ‘open’)

The code to open the window is nothing special

this.entity.element.on('click', function (evt) 
    {
        var win = window[1].open(link,'_blank');
        this.text.element.color = this.visitedLinkColor;
        evt.stopPropagation();
        console.log('The element ' + evt.element.entity.name + ' was clicked.');
    },this);
};

Debugging show that when launching the game via the editor the window object has an array with 2 Elements in it.
On our own server however the window object does not have an array.

Editor:
Editor

Our Server:
Build

Any ideas what might be causing this or how to fix it?

Thx in advance!

Hi ,

window object is global.So ,

window.open(link, '_blank').focus();

Above code works well for published projects

Hi,

thx for the suggestion but I get

window.open is not a function

It seems like window gets redefined somehow but I have no clue why or how.

Do you have demo/link of this? That looks like your window global is being redefined somewhere