Sets or gets the element's link.
When the element is clicked, the browser navigates to the
The different types of links you can use are:
/localPageURL: another page on your site
/: your site's home page
http(s)://<url>: an external web address
wix:document://<location>: a document stored in the Media Manager
mailto:<email-address>?subject=<subject>: an email
tel:<phone number>: a phone number
link property attempts to properly encode the URL value that
you set. For example,
.../some page is encoded to
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
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 (
a dynamic page URL which
contains the value of a field in your collection with spaces
has its spaces replaced with dashes (
Was this helpful?
1let url = $w("#myElement").link; // "http://mysite.com"
1$w("#myElement").link = "/about-me";
1$w("#myElement").link = "http://wix.com";
1$w("#myElement").link = "http://wix.com";2$w("#myElement").target = "_blank";
1$w("#myElement").link = "mailto:email@example.com?subject=Something%20Interesting";
1$w("#myElement").link = "wix:document://v1/9bec_52fb06ea/filename.xls";
1$w("#myElement").link = "tel:+1-555-555-5555";