Open URL on button click

I have an Input field with the id ‘slugInput’ and a button underneath with the id ‘submitButton’. I need people to enter their unique slug into the input field and for a page to open with the URL + slug.

The openURL doesn’t work. What do I replace it with? Is there a different way to solve this problem?

Thanks in advance. (see my code below)


import wixWindow from ‘wix-window’ ;

$w . onReady ( function () {
const input = $w ( ‘#slugInput’ );
const button = $w ( ‘#submitButton’ );

button . onClick ( function () {
const slug = input . value ;
const url = ‘https://mywebsite.com/’ + slug ;
wixWindow . openUrl ( url , ‘_self’ );
});
});

I solved this issue. Instead of opening the URL in the browser I have it open in an iframe that is hidden until the button is clicked.