I am trying to get a dropdown element to open a URL in a new window . The URL is generated based on the user’s selection. The value of each selection/choice is the URL that should be opened (see image below for configuration).
I have reviewed the documentation at the following link - https://www.wix.com/corvid/reference/$w/linkablemixin but the code is throwing the error "‘target’ does not exist on ‘#headerlogin’.
Below is my code.
export function headerlogin_change(event) {
let url = $w("#headerlogin").value;
$w("#headerlogin").link = url;
$w("#headerlogin").target = "_blank";
}
I should also note that I originally tried to use wix-location, but as far as I can tell it doesn’t allow links to be opened in a new window.
Any clarification would be appreciated, thank you
Hello Toby,
this little example should help you to solve your problem…(EXAMPLE-3)
https://russian-dima.wixsite.com/meinewebsite/website-navigation
export function dropdown3_change(event) {
let url = $w("#dropdown3").value;
$w("#button3").link = url
$w("#button3").target = "_blank";
}
export function button3_click(event) {
console.log($w("#button3").link)
}
I should also note that I originally tried to use wix-location, but as far as I can tell it doesn’t allow links to be opened in a new window.
And YES —> wixLocation does NOT support targetting in new window (tab)
Here you have a little proof for it…
This is because you can’t simulate a click with Corvid and you can’t make target _blank with wixLocation.
Thank you, but I would prefer not to use a button. Is this possible?
@_toby
Perhaps you will find a solution in the given LINK.
I do not have any other idea, right now, sorry.
Thank you, I will use your suggestion with the button.
I am glad if i could help you.