Register exact origins
- Give the scheme, host name and port only.
- Do not include a path, query, fragment, user name or password.
- Wildcards and partial matches are not supported.
- Register staging and production separately.
- Remove an origin when the site that uses it is retired.
Frame settings
Use the embed attributes the SDK provides, or copy the documented sandbox, allow, title and referrer policy exactly. Do not loosen the sandbox to make an integration error go away.
Checking messages
- Compare event.origin with the exact registered origin.
- Compare event.source with the expected frame or parent window.
- Check the protocol version, session ID, command name and payload shape.
- Reject unknown commands and oversized payloads.
- Never accept an API key or a permanent file URL through postMessage.
Content Security Policy
Your frame policy should allow only the viewer's origin and your registered parent origin. Test the headers your production site actually sends, because a proxy or CDN can add a conflicting or looser policy.