openAppLightbox( )


Opens a popup that was added to a site by the Blocks app during the app installation process and optionally passes it data.

Note: The terms popup and lightbox refer to the same element. While the editor and dashboard now refer to it as a popup, the API methods continue to use the term lightbox for backward compatibility. The documentation uses both terms accordingly.

The openAppLightbox() function returns a Promise that resolves to an object with data from the popup, when the popup is closed. Use it when a widget is installed as a popup.
Learn more about app and widget installation settings.

Note that to pass data back to the page that opened the popup, you must close the popup programmatically using the close() function. If the popup is closed by the site visitor clicking the 'X' icon, close button, or popup overlay, data will not be passed back the the page that opened the popup. Therefore, if you want to make sure data is passed back to the page that opened the popup, disable all of the methods mentioned above and create your own method for closing the popup programmatically. For example, you can add a button with an onClick event handler that calls the close() function.

Method Declaration
Copy
Method Parameters
lightboxIdstringRequired

The ID of the popup, as defined in the installation settings.


dataData

The data to pass to the popup.

Returns
Return Type:Promise<object>
Did this help?