iframe, so the comparison appears as part of your interface.
The basic embed
allowfullscreen lets users expand the comparison to fill their screen in most browsers. It is worth including: comparisons are detail-heavy, and a viewer confined to a small panel is hard to read.Embedding a private comparison
Comparisons are private by default, so in production yoursrc will usually be a signed URL:
Sizing the iframe
Aniframe will not size itself to its content. Give it an explicit height, or the viewer ends up in a short, unusable strip.
What the viewer does on its own
The embedded viewer handles its own states, so you do not need to build loading or error handling around it.Comparison does not exist yet
By default the viewer returns 404 if no comparison exists with that identifier. If you create comparisons in a background job and want to embed the viewer immediately, addwait and the viewer shows a loading state until the comparison appears:
When a comparison fails
If a comparison is ready but failed, the viewer displays a brief message to the user and writes a more descriptive one to the JavaScript console.Practical checklist
1
Sign URLs server side
Build the signed viewer URL in your backend and pass it to the template. The auth token must never reach the browser.
2
Give the iframe a real height
Use a viewport-relative height with a minimum, not a fixed small pixel value.
3
Include allowfullscreen
Users will want it for dense documents.
4
Match the expiry to the page
A signed URL that expires while someone is still reading is fine, since an open viewer keeps working until refresh. One that expires before the page loads is not.
5
Use wait if you create comparisons asynchronously
Otherwise the embed 404s for comparisons that have not been created yet.

