Skip to content
Middle+5 views

How will the website loaded in the iframe get the conference name or ID?

Practice

Asked at

AI answer

The conference ID is usually passed explicitly to the page inside the iframe—for example, as a URL parameter (/conference?id=123) or via postMessage. For data that should not appear in the URL, it is preferable to send a message from the parent page or have the server retrieve the data using an authenticated session.

When using postMessage, validate event.origin and the message structure, and have the sender specify an exact targetOrigin rather than *:

iframe.contentWindow.postMessage(
  { type: "conference:init", conferenceId: "123" },
  "https://conference.example.com"
);

The iframe page itself should accept messages only from a trusted origin. The passed ID must not be treated as proof of access rights—the server must verify the user's authorization separately.