Skip to content

findIframeInOpener

findIframeInOpener(pathname?): Window | null

Defined in: utils/iframe/iframeHelper.ts:152

Find an iframe within window.opener by pathname

When a popup is opened via window.open from an iframe, window.opener points to the parent window, not the iframe itself. This utility searches through all frames in window.opener to find an iframe matching the specified pathname.

string = "/listener"

The pathname to search for (default: “/listener”)

Window | null

The matching iframe window, or null if not found

// Find the default /listener iframe
const listenerIframe = findIframeInOpener();
// Find a custom iframe
const customIframe = findIframeInOpener("/my-custom-iframe");