Skip to main content



  • setupPostMessageRelay(nestedFrame: HTMLIFrameElement, expectedOrigin?: string): void

  • Setup a postMessage relay between the parent window and a nested iframe.

    When we’re running a Playground instance inside an iframe, sometimes that iframe will contain another iframe and so on. The parent application, however, needs to be able to communicate with the innermost iframe. This function relays the communication both ways. Call it in in every iframe layer between the topmost window and the innermost iframe.


    • nestedFrame: HTMLIFrameElement

      The nested iframe element

    • optionalexpectedOrigin: string

      The origin that the nested iframe is expected to be on. If not provided, any origin is allowed.

    Returns void