Sets or gets the button's link.
When the button is clicked, the browser navigates to the link
location.
The different types of links you can use are:
/localPageURL
: another page on your site/
: your site's home pagehttp(s)://
: an external web addresswix:document://
: a document stored in the Media Managermailto:?subject=
: an emailtel:
: a phone numberThe link
property attempts to properly encode the URL value that
you set. For example, .../some page
is encoded to .../some%20page
.
However, some URLs do not have one unambiguous encoding. In those cases
it is up to you to encode the URL to reflect your intentions. Because of
these situations, it is a best practice to always encode URLs before you
set them as the value of the link
property. Regardless of how you set
the link
property, when you get its value, it returns an encoded URL.
Note that Wix URLs do not contain spaces. A page which has spaces in its
name has its spaces replaced with dashes (-
). Similarly,
a dynamic page URL which
contains the value of a field in your collection with spaces
has its spaces replaced with dashes (-
).
Note: Make sure to set your button link before running (and not inside) the onClick()
event handler.