Allows the site component to listen to events that happen in the editor or website.
SDK Version: SDK 1.11.0 - 1.96.0+
Editor Version: New Editor, Old Editor
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page
Important:
Check the specific SDK version for each event. Events that are available in SDK versions higher than 1.45.0 are not supported in the old Editor. Learn more.
Make sure to register event listeners when the document loads, since previous listeners might be invalidated when we load your app.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
eventName (required) | Wix.Events | Unique event identifier, listed in the table below |
callback (required) | Function | A callback function that is called by the SDK once an event occurs |
The events that you can currently listen to are:
Event | Event Data | Description |
---|---|---|
COMPONENT_DELETED | {} | Issued when the user deletes a site component. Note: This event is only sent to the component that was deleted, so use the Wix.PubSub.publish method to alert other site components in your app about this event. For worker components, use Wix.Worker.PubSub.publish. Availability: Since 1.13.0 |
DEVICE_TYPE_CHANGED | { deviceType: 'desktop' or 'mobile'} | Issued when the user switches between the desktop editor and mobile editor. Availability: Since 1.45.0 |
EDIT_MODE_CHANGE | {editMode: 'editor' or 'preview'} | Issued when a user toggles between preview and edit mode in the editor. Availability: Since 1.11.0 |
INSTANCE_CHANGED | {instance: instanceValue} | Issued when a component in your app called Wix.revalidateSession in the live site.Availability: Since 1.96.0 |
KEY_DOWN | {charCode:0keyCode:39} | Issued when the user presses one of these keys on the keyboard:left/right arrows, esc, enter, space bar. Availability: Since 1.76.0 |
KEY_UP | {charCode:0keyCode:39} | Issued when the user presses one of these keys on the keyboard:left/right arrows, esc, enter, space bar. Availability: Since 1.76.0 |
MEMBER_DETAILS_UPDATED | For example: "attributes": { "name": "John Doe", "firstName": "John", "lastName": "Doe", "imageUrl": "https://myImage.jpg", "nickname": "Johnny "}} | Issued when a member changes their personal details. Availability: Since 1.89.0 |
PAGE_NAVIGATION | {"toPage": "Page1", "fromPage": "Page2"} | Issued on any page navigation in the website. Availability: Since 1.25.0 |
PAGE_NAVIGATION_IN | {"toPage": "Page1", "fromPage": "Page2"} | Issued on any page in navigation in the website. This event is a utility event on top of the PAGE_NAVIGATION event. Availability: Since 1.25.0 |
PAGE_NAVIGATION_OUT | {"toPage": "Page1", "fromPage": "Page2"} | Issued on any page out navigation in the website. This event is a utility event on top of the PAGE_NAVIGATION event. Availability: Since 1.25.0 |
PUBLIC_DATA_CHANGED | { key1: value1 } | Issued when app data is changed using Wix.Data.Public methods. Note that all registered components will get this event. Availability: Since 1.74.0 |
SCROLL | {"scrollTop": 4, "scrollLeft": 0, "documentHeight": 724, "documentWidth": 1227, "x": 124, "y": 131, "height": 682, "width": 978, "left": 124.5, "bottom": 809, "right": 1102.5, "top": 127} | Issued when scroll happens inside the site. The event data contains multiple details that helps the app determine its behavior considering its position in the site, the browser window dimensions, and the scrolling state: ScrollTop - site's scroll position on the y axis, scrollLeft - site's scroll position on the x axis, documentHeight - site's document height, documentWidth - site's document width, x - app offset within the site's page on the x axis, y - app offset within the site's page on the y axis, height - app height, width - app width, left - app top-left offset from the left, bottom - app top-left offset from the bottom, right - app top-left offset from the right, top - app top-left offset from the top. Availability: Since 1.25.0 |
SETTINGS_UPDATED | Custom json | Issued by the App Settings endpoint when new settings are applied by the user. Availability: Since 1.17.0 |
SITE_METADATA_CHANGED | { title: 'example title', description: 'example description' } | Issued when the page metadata (title, description) changes. Availability: Since 1.75.0 |
SITE_PUBLISHED | {} | Issued when the user publishes the website. Availability: Since 1.13.0 |
SITE_SAVED | {} | Issued when the user saves the website. Availability: Since 1.62.0 |
STATE_CHANGED | {newState: 'state'} | Issued when the website state changed. Learn more about the component's state and deep linking. Availability: Since 1.29.0 |
STYLE_PARAMS_CHANGE | {colors: Object, numbers: Object, booleans: Object, fonts: Object} | Issued when the user changed a color, font, number, or boolean value in your app’s settings panel. Availability: Since 1.22.0 |
THEME_CHANGE | {fonts: Object, siteTextPresets: Object, siteColors: Array (30 colors of palette), style: Object} | Issued when the user changed the site’s color palette. Availability: Since 1.22.0 |
WINDOW_PLACEMENT_CHANGED | "BOTTOM_RIGHT" | Issued when the user changed the position of a fixed-position widget. Availability: Since 1.18.0 |
Example:
Closes the modal or popup endpoint.
SDK Version: SDK 1.16.0+
Display: Live Site, Preview
Components: Modal, Popup
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
message | Object | A custom message to pass to the calling endpoint’s onClose callback function |
Example:
Retrieves the current Site Member, if one exists.
SDK Version: SDK 1.6.0+
Display: Live Site
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Callback function to receive member details |
Value passed to callback:
An object containing the Site Member’s details:
Name | Type | Description |
---|---|---|
name | String | Member's name |
String | Member's email | |
id | String | Member's ID |
owner | Boolean | True if the member is either the site owner or one of the site's contributors |
Example:
Retrieves the width and height of Wix ads in the live site.
SDK Version: SDK 1.77.0+
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page
You can use this data to position your site component correctly, so that there’s enough space between your app and the ad.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Callback function to receive the width and height of Wix ads on the page |
Value passed to callback:
An object with the width and height of each Wix ad on the page, in pixels. (If there are no ads, object is empty.)
Example:
Retrieves information about the bounding box (a rectangle) of the current component:
SDK Version: SDK 1.26.0+
Editor Version: New Editor, Old Editor
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | A callback function that returns the size and coordinates of the bounding rectangle and its offsets (in pixels) |
Value passed to callback:
An object that contains two objects – offsets and rect:
Name | Type | Description |
---|---|---|
offsets | Object | Coordinates of the top-left point of the bounding rectangle, relative to the top-left of the viewport |
offsets.x | Number | Left (x) coordinate value of the bounding rectangle |
offsets.y | Number | Top (y) coordinate value of the bounding rectangle |
rect | Object | Size of the component and its x,y coordinates, relative to the top-left of the viewport |
rect.width | Number | Width of the bounding rectangle |
rect.height | Number | Height of the bounding rectangle |
rect.top | Number | Top (y) coordinate value of the bounding rectangle |
rect.bottom | Number | Bottom (y) coordinate value of the bounding rectangle |
rect.left | Number | Left (x) coordinate value of the bounding rectangle |
rect.right | Number | Right (x) coordinate value of the bounding rectangle |
Example:
Retrieves information about the current component. For example, you’ll be able to know if a widget is shown on all pages.
SDK Version: SDK 1.64.0+
Editor Version: New Editor
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | A callback function to get information about the component |
Value passed to callback:
An object containing the component info:
Name | Type | Description |
---|---|---|
compId | String | The unique ID of this component in the Wix site |
pageId | String | ID of the page that contains the component. Returns null if the component is a widget that’s set to show on all pages. |
showOnAllPages | Boolean | True if the user set the widget to show on all pages. False if the component is a page, or if the widget is not set to show on all pages. |
tpaWidgetId | String | ID of the widget component, as specified in the Dev Center. Returns null if the component is a page, or if you’re using this method in the live site. |
appPageId | String | ID of the page component, as specified in the Dev Center. Returns null if the component is a widget, or if you’re using this method in the live site. |
Retrieves the anchors on the current page.
SDK Version: SDK 1.62.0+
Editor Version: New Editor
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Note:
In the settings endpoint, use Wix.Settings.getCurrentPageAnchors instead.
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Callback function to receive an array of anchors (unordered) |
Value passed to callback:
An array of unordered objects. If there are no anchors on the current page, method retrieves just one default anchor – the top of the page.
Each object represents an anchor on the current page, and contains the following properties:
Name | Type | Description |
---|---|---|
id | String | The anchor ID |
title | String | The anchor title |
Example:
Retrieves the ID of the current page.
SDK Version: SDK 1.31.0+
Editor Version: New Editor, Old Editor
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Warning:
Navigating to a page using its pageId? Don’t use this method to get the pageId – use Wix.getCurrentPageNavigationInfo instead.
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Callback function to receive the pageId |
Value passed to callback: A string representing the pageId.
Example:
Retrieves navigation info for the current page in the site.
SDK Version: SDK 1.91.0+
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
This method supports both regular and dynamic pages (such as pages created with Wix Code or a data-binding app).
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Callback function to receive an object with details about this page.Use this object when navigating to the page - see Wix.navigateTo. |
Value passed to callback: An object with the data needed to navigate to this page. Save the object in your database and navigate to the page using Wix.navigateTo.
Warning:
Save this object in your database as is – don’t change it in any way.
Example:
Retrieves information about the site where your app is installed.
SDK Version: SDK 1.3.0+
Editor Version: New Editor, Old Editor
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal,Popup
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Callback function to receive the site info |
Value passed to callback:
Object containing the site info:
Name | Type | Description |
---|---|---|
baseUrl | String | Base url of the current site, for example: http://user.wix.com/site-name , http://www.domain.com |
pageTitle | String | The page title that is used for SEO. This title includes both the site and page title (e.g., “My Store / Animal Shirt”). |
pageTitleOnly | String | The name of the page - without the site title (e.g., “Animal Shirt”). |
referrer | String | The referrer header of the HTTP request |
siteDescription | String | The description of the site that is used for SEO |
siteKeywords | String | The keywords which are related to the site and are used for SEO |
siteTitle | String | The title of the site that is used for SEO |
url | String | The URL (taken from the location.href property). The URL includes the internal site state, for example: http://user.wixsite.com/site-name/pageTitle , http://www.domain.com/pageTitleReturns the site URL only when using getSiteInfo in the live site and preview mode. When using it in Editor mode, returns the Editor URL. |
Example:
Retrieves all items in the site structure, including:
SDK Version: SDK 1.81.0+
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Note:
Use this method instead of getSitePages, which is now deprecated.
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Callback function to receive the site structure |
Value passed to callback:
An array of objects, where each object represents an item in the site structure.
Warning: To use this object later (for example, if you want to navigate to a link onthe user’s site), save this object in your database as is – don’t change it in any way.
Each object contains data about the item. The data sent depends on the item – check out our examples below.
Name | Type | Description |
---|---|---|
type | String | Type of link the item represents - for example ‘PageLink’ or ‘AnchorLink’.The data returned depends on the item - for example, an ‘AnchorLink’ object will include the anchorName and anchorDataId properties. Check out our examples below. |
pageId | String | The page ID. Note: If the user added a page anchor to the site’s menu, then this method returns an object for the anchor - so there might be multiple objects with the same page ID. |
title | String | The item title |
hidden | Boolean | Returns true if this page is hidden |
isHomePage | Boolean | Returns true if this page is the site's home page |
url | String | URL of this item |
subPages | Array [objects] | (Page objects only) If the page has subpages, returns an ordered set of subpages. Each subpage object contains more information about the subpage (id, title, hide, isHomePage, url). |
Here’s an example of an array passed to the callback function:
Example:
This method retrieves the full URL of one of your internal pages on the live site, including the app’s state. For example:
mysite.com/my-store-app/product1.
SDK Version: SDK 1.69.0+
Editor Version: New Editor
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Use this method if you have a Page component and you need the URL of an internal page.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
sectionId (required) | String | ID of the Page component, as specified in the Dev Center |
state (required) | String | State of the app’s internal page - for example, ‘product1’ |
callback (required) | Function | Callback function to receive the full URL of the page, including the app state |
Example:
Allows you to check if another one of your apps is installed.
SDK Version: SDK 1.86.0+
Editor Version: New Editor
Display: Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
appDefinitionId (required) | String | App ID, as specified in the Developers Center |
callback (required) | Function | Callback function that receives a boolean indicating if the app is installed in the site: function(isInstalled) {} |
Example:
Allows you to check if the user added one of your app’s hidden or custom pages (like a thank you or checkout page).
SDK Version: SDK 1.89.0+
Editor Version: New Editor
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
sectionId (required) | String | ID of the Page component, as specified in the Developers Center |
options | Object | Options for this method |
options.appDefinitionId | String | If the Page component is in a different one of your apps, enter that app’s ID (specified in the Developers Center) |
callback (required) | Function | Callback function that receives a boolean indicating if the Page component is installed in the site: function(isInstalled) {} |
Example:
Checks if the user enabled visual focus for the live site. If your account manager told you to manually inject visual focus into your app, use this method before displaying visual focus.
SDK Version: SDK 1.87.0+
Display: Live Site
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Important:
In most cases, we take care of visual focus and all you need to do is make sure you’re using SDK 1.84.0 or later. During the app review, we’ll let you know if you need to manually inject visual focus properties.
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Function that receives a boolean indicating if visual focus is enabled: function(isEnabled) {} |
Example:
Logs out a site member from the Wix site, and then refreshes the iframe. This method is relevant for apps that require site visitors to log in as members of the site.
SDK Version: SDK 1.67.0+
Display: Live Site
Component: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
onError | Function | Callback function with error details. An error is thrown if there is no site member logged in. |
Example:
Navigates to a page or link object. This object is passed to the callback function in one of these methods:
SDK Version: SDK 1.81.0+
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
linkData (required) | Object | Object with link data, received in the callback function of these methods: Wix.Settings.openLinkPanel, Wix.getCurrentPageNavigationInfo, getSiteMap (Wix.getSiteMap, Wix.Settings.getSiteMap, or Wix.Worker.getSiteMap |
onFailure | Function | Callback function to receive details about a navigation error |
Example:
Note:
In preview, this method can’t open the link in the current window (_self). In SDK versions 1.94.0 and later, we send the following error code and you can display a message for users (e.g., “This link will work on your Published site.”)
Navigates to an anchor on the current page.
SDK Version: SDK 1.62.0+
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
anchorId (required) | String | ID of the anchor to navigate to |
onFailure | Function | Callback function to receive an object that specifies the error. An error is invoked when the anchor doesn’t exist on the current page. |
Example:
Directs site visitors to another component of your app.
SDK Version: SDK 1.47.0+
Display: Live Site, Preview
Component: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
compId (required) | String | The component to send site visitors to |
options | Object | Options for this function |
options.pageId | String | You can specify the pageId to navigate to. When pageId is not provided, the function navigates to a component with the given id on the current page. |
onFailure | Function | Callback function to receive an object that specifies the error. An error is invoked when: The current page does not contain the given component (and pageId was not provided), The provided pageId is not valid, The pageId is given but the page does not contain a component with the provided component ID. Note: The function will first navigate to a page with the provided pageId as an effect of this API call. |
Example:
Navigates to a specific page or anchor in the site.
SDK Version: SDK 1.68.0+
Editor Version: New Editor
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Note:
In the Editor, you can use this method to navigates to pages only – not anchors.
Parameters:
Name | Type | Description |
---|---|---|
pageId (required) | String | The page ID of the target page. Retrieve this id using the Wix.getSiteMap method. |
options | Object | Options for this method |
options.anchorId | String | The ID of the anchor on the page. Retrieve this id using the Wix.getCurrentPageAnchors method.If the anchorId is specified, the method first navigates to the page (according to the pageId parameter), and then scrolls to this anchor. Note that you can only navigate to an anchor in the live site/preview - not in the Editor. |
onFailure | Function | Callback function to receive an object that specifies the error. An error is thrown when: The anchorId doesn’t exist on the specified page, or the pageId doesn’t exist. |
Example:
Runs the specified function once the DOM loads. The DOM here refers to the Wix Editor or a page in the live site.
SDK Version: SDK 1.102.0+
Editor Version: New Editor
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page
Syntax:
Note:
By waiting to run your code until the DOM is ready, you can help improve user experience and loading times.
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Function to run when the DOM is loaded |
Example:
Opens a lightbox-style modal window over the Wix site.
SDK Version: SDK 1.16.0+
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Here’s how the modal works:
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
url (required) | String | URL of the modal iframe |
width (required) | Number | Width of the modal, in pixels (for example, 400) |
height (required) | Number | Height of the modal, in pixels (for example, 400) |
onClose | Function | OnClose callback function |
theme | Wix.Theme | The style of the modal: Wix.Theme.DEFAULT - has the regular modal look & feel - border, shadow, close button. Wix.Theme.BARE - a simple modal with no border, close button, shadow, etc. |
Example:
Opens a popup window in the live site or the preview mode of the Wix editor.
SDK Version: SDK 1.17.0+
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page
Here’s how the popup works:
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
url (required) | String | URL of the popup iframe |
width (required) | Number/ String | Width of the popup. In pixels: Enter a number (for example, 400), In percent: Enter a string (for example,‘70%’) |
height (required) | Number/ String | Height of the popup. In pixels: Enter a number (for example, 400). In percent: Enter a string (for example,‘70%’) |
position (required) | Object | The position of the popup in the viewport |
position.origin (required) | Wix.WindowOrigin | Where to open the popup from: Wix.WindowOrigin.FIXED - Positions the popup relative to the browser viewport. The popup stays fixed to this position, even if the user scrolls. Wix.WindowOrigin.RELATIVE - Positions the popup relative to the component that opened it (i.e, your site component). The popup stays fixed to the component, even if the user scrolls. Wix.WindowOrigin.ABSOLUTE - Positions the popup at specific coordinates (x,y). These coordinates are relative to the top-left corner of the component that opened it, and not the viewport. (The coordinates of the component’s top-left corner are 0,0.) |
position.placement | Wix.WindowPlacement | Where to position the popup, relative to the origin you set above. The possible values are: Wix.WindowPlacement.TOP_LEFT, Wix.WindowPlacement.TOP_CENTER, Wix.WindowPlacement.TOP_RIGHT, Wix.WindowPlacement.CENTER_LEFT, Wix.WindowPlacement.CENTER, Wix.WindowPlacement.CENTER_RIGHT, Wix.WindowPlacement.BOTTOM_LEFT, Wix.WindowPlacement.BOTTOM_CENTER, Wix.WindowPlacement.BOTTOM_RIGHT. The default value is Wix.WindowPlacement.CENTER. |
onClose | Function | OnClose callback function |
Theme | Wix.Theme | The style of the popup window. Wix.Theme.DEFAULT - has the regular popup look & feel, with a border, shadow, close button. Wix.Theme.BARE - a simple popup with no border, close button, shadow, etc. |
Note:
When we render the popup, we’ll calculate if the popup will fit in the requested position with the specified size. If not, we’ll set the position to the center of the viewport:
{origin: Wix.WindowOrigin.FIXED, placement: Wix.WindowPlacement.CENTER}
This can happen when you set the origin to RELATIVE or ABSOLUTE, because the popup might be bigger than the margin between the site component and the viewport.
Examples:
Open a popup window positioned in the center of the screen (size is in pixels):
Open a popup window positioned relative to the center of the component (size is in %):
Open a popup window positioned to the bottom right of a specific point (x,y).
Calculate the x and y coordinates relative to the top-left corner of the site component that’s opening the popup – the coordinates of this corner are 0,0.
Enables AJAX style page apps to inform the Wix platform about a change in the app’s internal state. The new state will be reflected in the site/page URL. Once you call the pushState method, the browser’s top window URL will change the ‘app-state’ path part to the new state you provide with the pushState method (similar to the browser history API ). Read more about deep linking for a full explanation.
SDK Version: SDK 1.08.0+
Display: Live Site
Components: Page
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
state (required) | String | The new app's state to push into the editor history stack |
Example:
Allows to remove previously assigned event listeners that were specified using Wix.addEventListener.
SDK Version: SDK 1.25.0+
Editor Version: New Editor, Old Editor
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
eventName (required) | Wix.Events | Unique event identifier |
CallBackOrId (required) | Function | A callback function that was used with addEventListener, or an ID returned by addEventListener |
Example:
This method is like the pushState method, except that this method replaces the URL in the browser’s history.
SDK Version: SDK 1.106.0+
Display: Live Site
Components: Page
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
state (required) | String | New state to push to the URL |
options | Object | Options for this method |
options.queryParams | String | Parameters to push to the URL |
Example:
Prompts the site visitor to log in or register to the site. After a successful login, the site (and app iframe) will reload. The signed-instance parameter is added, with details about the site visitor.
SDK Version: SDK 1.69.0+
Display: Live Site
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
This method is relevant for apps that require site visitors to log in as members of the site.
Parameters:
Name | Type | Description |
---|---|---|
dialogOptions | Object | Options for opening the login dialog box |
dialogOptions.mode | 'login' or 'signup' | Defines which dialog box should open by default: login or signup |
dialogOptions.language | String | Language to use for the dialog box, as an ISO 639-1 language code. For example, ‘en’ or ‘es’. |
callback (required) | Function | Callback function to receive the member's details |
onFailure | Function | Callback function to use when the site visitor doesn’t log in successfully |
Example:
Resizes a component without affecting adjacent components. It is the equivalent of using the editor’s size toolbar.
SDK Version: SDK 1.50.0+
Editor Version: New Editor
Components: Widget, Page
Syntax:
Note:
For fixed-position widgets, use resizeWindow instead.
Parameters:
Name | Type | Description |
---|---|---|
options (required) | Object | Specify width and/or height (you must specify at least one) |
options.width | Number | Size in pixels, for example: 450.If you don’t provide a value, the width remains the same. |
options.height | Number | Size in pixels, for example: 450. If you don’t provide a value, the height remains the same. |
onSuccess (required) | Function | Returns the new component size |
onFailure | Function | Error message invoked when no value is provided for width and height (you must give a value for at least one) |
Example:
Sets the width and/or height of a fixed-position widget. For widgets and pages, use resizeComponent instead.
SDK Version: SDK 1.19.0+
Editor Version: New Editor, Old Editor
Display: Live Site, Preview
Components: Pinned (aka Fixed-Position) Widget
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
width (required) | Number | The new window's width |
height (required) | Number | The new window's height |
onComplete (required) | Function | On resize complete callback function |
Example:
Verifies that the session is secure. If the session is secure, this method returns a newly-signed app instance.
SDK Version: SDK 1.96.0+
Editor Version: New Editor
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page
Use this method before displaying sensitive information or performing an action that requires a secure session.
Syntax:
Important:
Using this method in the live site? We don’t refresh the iframe with the new instance, so make sure to also listen for the INSTANCE_CHANGED event. This notifies any other components of your app in the site that the instance was updated, as well as components of your app that the user copied multiple times.
Parameters:
Name | Type | Description |
---|---|---|
onSuccess (required) | Function | Receives a newly-signed and encoded app instance |
onFailure | Function | Callback function in case the session isn't secure |
Example:
Performs a scroll by the specified number of pixels in the app’s hosting site window exactly as the standard method does.
SDK Version: SDK 1.19.0+
Display: Live Site, Preview
Component: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
x (required) | Number How many pixels to scroll by, along the x-axis (horizontal) | |
y (required) | Number | How many pixels to scroll by, along the y-axis (vertical) |
Example:
Note:
In SDK versions 1.45.0 and earlier, this method was also available in the Editor. Since SDK v1.46.0, it is available only in the live site and preview.
Performs a scroll to a fixed position in the app’s hosting site window exactly as the standard method does.
SDK Version: SDK 1.89.0+
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
x (required) | Number | The coordinate to scroll to, along the x-axis |
y (required) | Number | The coordinate to scroll to, along the y-axis |
options | Object | Options for this method |
options.scrollAnimation | Boolean | Indicates whether to scroll with an animation. true - scrolls with an animation, false - scrolls directly to the target, with no animation |
Example:
In editing mode, this method causes re-measurement and re-adjustment of adjacent components. It is the equivalent of using the resize handle in the editor, “pushing” other components downward or upward as necessary.
SDK Version: SDK 1.50.0+
Editor Version: New Editor
Display: Live Site, Preview
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Modal, Popup
You can do one of the following:
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
height (required) | Number | An integer that represents the desired height in pixels. Important: The max height is 10,000px. When exceeded, the app frame is cut in the live site. |
options | Object | Options for this method |
options.overflow | Boolean | Tells the platform how to display the component. true to display and resize this component over other components on the page, false to push other components further down the page (the default behavior). |
Example:
Sets metadata for the page. Search engines display this metadata – the page’s title and/or description – in search results.
SDK Version: SDK 1.67.0+
Display: Live Site
Components: Page
Syntax:
Important:
Make sure the title and description you add here match your app’s SEO endpoint.
Parameters:
Name | Type | Description |
---|---|---|
options | Object | Page metadata |
options.title | String | The name of this page (for example, the product name). We’ll insert this name into the page title. |
options.description | String | The page description |
Example:
Retrieves all pages in this site. A page can be:
SDK Version: Deprecated
Warning:
Now that this method is deprecated, use getSiteMap instead.
Parameters:
Name | Type | Description |
---|---|---|
options | Object | Options for this method |
callback (required) | Function | A callback function to receive the site structure |
Returns: An array of objects, where each object represents a page in the site.
The objects are ordered according to the site’s structure shown in the Pages menu of the Wix Editor. If a page has subpages, they are returned as an array of objects nested inside the page object.
Each page/subpage object contains the following properties:
Name | Type | Description |
---|---|---|
id | String | The page/subpage ID. If the user added a page anchor to the site’s menu, then this method returns an object for the anchor - so there might be multiple objects with the same page ID |
title | String | The title of the page/subpage |
hide | Boolean | Returns true if this page/subpage is hidden |
isHomePage | Boolean | Returns true if this page/subpage is the site's home page |
subPages | Array [objects] | (Page objects only) If the page has subPages, returns an ordered set of subpages. Each subpage object contains more information about the subpage (id, title, hide, isHomePage, url). |
Requests the hosting Wix platform to change the iframe’s height inside the website or the editor.
SDK Version: Deprecated
Warning:
Now that this method is deprecated, use setHeight instead.
Parameters:
Name | Type | Description |
---|---|---|
height (required) | Number | An integer that represents the desired height in pixels |