મુખ્ય સામગ્રીને બાયપાસ કરો

setupPostMessageRelay

Callable

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

  • Forward messages marked type: 'relay' between the parent window and a child iframe.

    For example, in app -> remote.html -> WordPress, remote.html calls this with the WordPress iframe. A message from either adjacent window is forwarded to the other; messages from unrelated windows are ignored. Call this in each intermediate layer when there are more nested frames.

    expectedOrigin applies to the child: it filters replies and targets requests, so the child may be cross-origin. The parent may be an external embedder; its window is checked, but its origin is not restricted here.


    Parameters

    • nestedFrame: HTMLIFrameElement

      The nested iframe element

    • optionalexpectedOrigin: string

      The nested iframe's origin, used to filter incoming messages and target outgoing ones. If omitted, incoming messages may use any origin, but outgoing messages stay same-origin.

    Returns void