Include the following script tag in your HTML document:
Once included, your window object will contain a new global Object named Wix.
Note the following:
- We document the latest SDK version for each method. If a method is updated, we update its SDK version accordingly. For example: if a method is available since SDK 1.45.0 and updated in SDK 1.95, our documentation lists SDK 1.95 as the version. Update your app to the latest version so that you can use all parameters in the method.
- When calling a method from the Editor, check the Editor version. Starting from SDK 1.45.0, methods are not supported in the old Editor. When using more recent methods in the Editor, provide a fallback option for users in the old Editor. Keep reading to learn more.
In 2015, we launched a new and improved version of the Wix Editor. We are gradually moving users over to the new Editor, so some users are still using the old Editor.
All methods that are available since SDK version 1.45.0 are not supported in the old Editor. To use these methods, you’ll need to detect the user’s Editor version and add a fallback option for the old Editor.
- Call the Wix.Features.isSupported function and specify the feature you want to use. If the user is in the new Editor, you receive true via callback and you then need to call the relevant function.
- Make sure to include a fallback behavior for your app in case the user is in the old Editor (like an alternate function) – otherwise, an error will occur.
The Wix global object can be used in all components’ endpoints – Widget, Page, Fixed Position, Dashboard, Worker, and App Settings – as well as its controls – Modal and Popup. However, some of its functions make sense only in certain endpoints.
The most obvious distinction is the App Settings endpoint.
The App Settings endpoint is different since it is the only endpoint that resides in the Editor while the others reside in the user’s website or the My sites dashboard. For that reason we created a namespace Wix.Settings that holds all the functions that are valid in the App Settings endpoint.
Another special namespace is the Wix.Utils. It provides utility functions that can be called by all endpoints (except worker).
Although Wix.Utils is valid for all endpoints (except worker), if the called function doesn’t have a meaningful value to return, it returns null. For example, when Wix.Utils.getOrigCompId() is used in the App Settings endpoint, the function returns the component ID that called it – but for other endpoints, it returns null.
If you see a method in our SDK has a callback function, this means that the method is asynchronous. The “return” value is passed as an argument in the callback function.
Was this helpful?