Search.../

openModal( )

Opens a modal window that displays the specified web page.

Description

A modal window displays the page specified by the url property over your current page. Unlike a lightbox, which is opened using the openLightbox() function, the window opened by openModal() is not part of your site structure.

Only one modal window can be open at any given time. Therefore, opening a modal window closes an already open modal window if there is one.

Note: The specified url must be an HTTPS URL.

Syntax

function openModal(url: string, options: OpenModalOptions): Promise<void>

openModal Parameters

NAME
TYPE
DESCRIPTION
url
string

The URL of the page to show in the modal window.

options
OpenModalOptions

The options used for the modal window.

Returns

Fulfilled - When the modal window is closed. Rejected - The error that caused the rejection.

Return Type:

Promise<void>

Related Content:

Was this helpful?

Open a modal window

Copy Code
1import wixWindowFrontend from 'wix-window-frontend';
2
3// ...
4
5wixWindowFrontend.openModal("https://en.wikipedia.org/wiki/Wix.com", {
6 "width": 750,
7 "height": 500
8} );
Open a modal window and log a message when it is closed

Copy Code
1import wixWindowFrontend from 'wix-window-frontend';
2
3// ...
4
5wixWindowFrontend.openModal("https://en.wikipedia.org/wiki/Wix.com", {
6 "width": 750,
7 "height": 500
8 } )
9 .then( () => {
10 console.log("Modal closed.");
11 } );