The link on a table linked to a dynamic page, does not open the new page on empty target. Why?
And it doesn't even work with the "link parameter" anymore..
$w("#mybutton").link = "https://miosito.com";
$w("#mybutton").target = "_blank";
Before it worked, now not
Thanks
Claudio
One thing I just discovered is that if you have an onClick handler for the button, it takes precedence over any .link and .target specification you may make in your onReady handler. I have a page with a link that does two different things depending on whether you are an admin or a regular member of the website. Because of this precedence behavior I can't reuse the button to do two different things. Instead, I must create a second button that sits on top of the first one and I show/hide the appropriate one depending on who is logged in.
Bottom line, Claudio you should detach your button174_click(event) handler from the button otherwise it won't work!
Thanks GOS for many explanations, but this solution doesn't work for me, why?
Nothing is happening, does not open any page.
export function button174_click(event) { $w("#button174").link = "http://wix.com"; $w("#button174").target = "_blank"; }
Also, why this configuration don't works for dynamic page tables connection?
Opens the page, but not in a new one
Thanks a lot
Claudio
This has been asked in the forum previously and was mentioned recently too, so have a search of the forum and you should find those previous posts.
Like this one here.
https://www.wix.com/corvid/forum/community-discussion/how-to-link-a-button-using-code
However, the answer was to put the target part of the code from the LinkableMixin API into your pages onReady function (see in above link.)
https://www.wix.com/corvid/reference/$w.LinkableMixin.html
Plus, you can't mix it up with the Wix Location API and the to function as well.
https://www.wix.com/corvid/reference/wix-location.html#to
Although, unless something has changed you should be opening that in a new tab already anyway.
Link targets are only supported for external web links (e.g. http://www.wix.com).
if you are trying to open another page from your website and have it setup like this, then it will open in the same window. $w("#myElement").link = "/about-me";
Set an element to open an external web link in a new browser page when clicked
$w("#myElement").link = "http://wix.com"; $w("#myElement").target = "_blank";