Skip to Content

Iframe and legacy script

Two other ways to place the widget, for site builders that block scripts or only accept a single tag.

Iframe

For hosts that do not allow <script> tags, embed the hosted widget page in an iframe:

<iframe
  src="https://whocoming.com/embed/evt_demo0000000000000001"
  title="RSVP"
  width="100%"
  height="420"
  style="border: 0; max-width: 480px"
></iframe>

Let the iframe size itself

The page inside the iframe tells its parent how tall the widget is, on load and whenever it changes size (the form opens, the RSVP is done), with a message:

{ type: "whocoming:resize", event: "evt_demo0000000000000001", height: 512 }

height is in CSS pixels. The message carries only the event ID that is already in the iframe's address, nothing about guests.

If your site lets you add a little inline script (many builders that block outside scripts still allow it), listen for it and set the height. Check that the message comes from https://whocoming.com and from one of your iframes:

<script>
  window.addEventListener("message", (e) => {
    if (e.origin !== "https://whocoming.com") return;
    const data = e.data;
    if (!data || data.type !== "whocoming:resize" || typeof data.height !== "number") return;
    for (const frame of document.querySelectorAll('iframe[src^="https://whocoming.com/embed/"]')) {
      if (frame.contentWindow === e.source) frame.style.height = `${Math.ceil(data.height)}px`;
    }
  });
</script>

Without a script, the iframe keeps the height you gave it. Pick one that fits your form (more custom questions need more room).

Trade-offs compared with the element

  • The iframe only grows to fit its content with the script above.
  • Your CSS variables and ::part() rules cannot reach inside it, and it does not fire DOM events on your page.
  • Event structured data is not added to your page.

Use the element when you can.

Legacy single script

Some builders accept one script tag but no custom HTML. Put the event on the script itself, and the widget is inserted right after it:

<script async src="https://cdn.whocoming.com/embed.js" data-event="evt_demo0000000000000001"></script>

Every attribute works with a data- prefix:

<script
  async
  src="https://cdn.whocoming.com/embed.js"
  data-event="evt_demo0000000000000001"
  data-theme="dark"
  data-accent="#ffc83d"
  data-compact
></script>

This form places one widget per script tag. For several events on one page, use the element.

On this page