> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: getContext() # Method package: wixWindowFrontend # Method menu location: wixWindowFrontend --> Lightbox --> getContext # Method Link: https://dev.wix.com/docs/velo/apis/wix-window-frontend/lightbox/get-context.md # Method Description: Gets the data object that was passed to a popup. > **Note:** The terms popup and lightbox refer to the same element. While the editor and dashboard now refer to it as a [popup](https://support.wix.com/en/article/studio-editor-using-popups), the API methods continue to use the term lightbox for backward compatibility. The documentation uses both terms accordingly. Retrieves the data object, if any, that was passed when a popup was opened with the [`openLightbox()`](https://dev.wix.com/docs/velo/api-reference/wix-window-frontend/open-lightbox.md) method. If a popup was opened in any other way, `getContext()` returns `undefined`. To pass data to a popup, it must be opened programmatically using the [`openLightbox()`](https://dev.wix.com/docs/velo/api-reference/wix-window-frontend/open-lightbox.md) method. Popups that are opened automatically on page load, or with a link from a page element don't receive passed data. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Get the data that was passed to a popup ```javascript import wixWindowFrontend from 'wix-window-frontend'; // ... let receivedData = wixWindowFrontend.lightbox.getContext(); ``` ## Open and close a popup, and send information between a popup and a page ```javascript /****************** * Home Page Code * ******************/ import { openLightbox } from 'wix-window-frontend'; $w.onReady(() => { $w('#openButton').onClick(async () => { const dataToSend = { greeting: $w('#greeting').value, subject: $w('#subject').value }; const lightBoxResponse = await openLightbox('Greeting Lightbox', dataToSend); $w('#returnedMessage').text = `YOU CHOSE: ${lightBoxResponse}`; $w('#returnedMessage').show(); }); }); /***************** * Lightbox Code * *****************/ import { lightbox } from 'wix-window-frontend'; $w.onReady(function () { let receivedData = lightbox.getContext(); $w('#greeting').text = receivedData.greeting.toUpperCase(); $w('#subject').text = receivedData.subject.toUpperCase(); $w('#blueButton').onClick(clickHandler); $w('#greenButton').onClick(clickHandler); $w('#pinkButton').onClick(clickHandler); }); function clickHandler(event) { lightbox.close(event.target.label); } ``` ## A scenario where information is passed between a page and a popup ```javascript /************* * Page Code * *************/ import wixWindowFrontend from 'wix-window-frontend'; export function openButton_click(event) { wixWindowFrontend.openLightbox("MyLightBox", { "pageSend1": $w('#pageSend1').value, "pageSend2": $w('#pageSend2').value }) .then( (data) => { $w('#pageReceive1').text = data.lightBoxSend1; $w('#pageReceive2').text = data.lightBoxSend2; } ); } /***************** * Lightbox Code * *****************/ import wixWindowFrontend from 'wix-window-frontend'; $w.onReady( function () { let received = wixWindowFrontend.lightbox.getContext(); $w('#lightBoxReceive1').text = received.pageSend1; $w('#lightBoxReceive2').text = received.pageSend2; } ); export function closeButton_click(event) { wixWindowFrontend.lightbox.close( { "lightBoxSend1": $w('#lightBoxSend1').value, "lightBoxSend2": $w('#lightBoxSend2').value } ); } ``` ---