Search.../

link

Sets or gets the element's link to an external site.

Description

When the element is clicked, the browser navigates to the external link location.

The 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.

Type:

stringRead & Write, default value is An empty string

Related Content:

Was this helpful?

Get the link URL from an element

Copy Code
1let url = $w("#myButton").link; // "https://dev.wix.com/docs/develop-websites"
Set an element to open an external web link

Copy Code
1$w("#myButton").link = "http://wix.com";
Set an element to open an external web link in a new browser page when clicked

Copy Code
1$w("#myButton").link = "https://dev.wix.com/docs/develop-websites";
2$w("#myButton").target = "_blank";