Embed a form on your site
Drop a form into any website with an iframe, with auto-height and a working payment.
Embed a form
A JomForm form drops into any website with an iframe. It renders the full form: fields, validation and payment.
A submit lands in the form's submissions and sales, exactly as it would on the form's own page.
The buyer reaches CHIP checkout and the thank-you page in the top frame, so payment works inside the embed.
1. Paste the embed snippet
Turn on Allow embedding (iframe) in the form's settings, then paste this on your page.
Replace your-workspace and your-form-slug with your workspace slug and the form's slug.
<iframe src="https://yourworkspace.jomform.com/embed/f/your-workspace/your-form-slug"
style="width:100%;height:640px;border:0"
title="Your form"></iframe>With embedding switched off, that address answers 403 instead of rendering the form. Turn the setting on first.
2. Auto-height (recommended)
A fixed height causes inner scrollbars on longer forms.
The form posts its height over postMessage on load, on resize, and whenever its content changes: conditional fields, product selection, the confirmation message.
Listen for jomform:height and set the iframe's height. That is the whole listener.
<iframe src="https://yourworkspace.jomform.com/embed/f/your-workspace/your-form-slug"
style="width:100%;height:640px;border:0"
title="Your form"></iframe>
<script>
addEventListener("message", e => {
if (e.data?.type === "jform:height") document.querySelector("iframe").style.height = e.data.height + "px";
});
</script>Without the listener nothing breaks: the frame keeps the 640px you set, and longer forms scroll inside it.
The message contract
Two fields arrive with every message. Filter on type before you touch the DOM.
| Field | Meaning |
|---|---|
| type | Always "jomform:height". Filter on it so your other listeners ignore the message. |
| height | The form's content height in pixels. Set it as the iframe's CSS height. |
Sandboxed iframes
Plain iframes work as they are. A sandbox attribute needs four tokens: allow-forms, allow-scripts, allow-same-origin and allow-top-navigation.
Those let the form submit and the buyer reach checkout in the top frame.
allow-forms the form cannot submit. Without allow-top-navigation the buyer cannot reach checkout.CORS
No CORS configuration is needed. The form's JavaScript posts to location.pathname + "/order".
That is same-origin: the iframe document is JomForm, so the browser never makes a cross-origin request.
Why not the plain form URL?
The ordinary public URL is meant to be opened directly, so JomForm sends it X-Frame-Options: SAMEORIGIN.
A browser will not render it inside a frame on another domain. You get an empty frame or a refusal.
That is a deliberate guard against a page wrapping JomForm in an invisible frame to trick a buyer. Do not work around it.
<iframe src="https://yourworkspace.jomform.com/your-form-slug"
style="width:100%;height:640px;border:0"
title="Your form"></iframe>The embed URL exists for exactly this case and is the only address framable from your site.
Related: the customization guide covers your own colours, CSS and JS.