client_id.
Build the URL with frame() from the JavaScript client, created with your Application client_id. frame() puts the client_id in the URL, and the iframe opens only from a URL that has one.
src, as in Height and events. The page has no chrome and a transparent background, so your page shows through.
Try it
The iframe in /integrate, with the URL
frame() builds, the host code and every message it posts.What you need
- An Application
client_idfrom the Neutron dashboard. Embedding needs API credentials, which come with Launch and above. - In that credential’s allowed URLs:
- Every domain where your pages show the iframe.
- The Prescribe app’s domain, where the iframe signs the prescriber in:
https://rx.neutron.healthin the sandbox, orhttps://rx.newin production.
Building the URL
Each record’sframe() takes Photon ids only, and reads and writes nothing. The URL uses the same paths and parameters as deep links, under /embed.
URLs start with
https://rx.neutron.health in the sandbox, or https://rx.new in production, which is in private preview.
To give a flow more than one record, pass the whole link to ph.frame():
frame() refuses anything else. To start from a patient Photon hasn’t matched yet, sync their details from your backend first (patient sync) and pass the id it returns.
A live object you already have makes its own: order.frame().
When the URL names the patient by id, the iframe stays on that patient, with no Change patient.
A URL without a client_id shows This link can’t be embedded and does nothing else. An id Photon doesn’t have in the prescriber’s organization opens as not found on its card, and the rest still opens.
Height and events
The iframe posts messages to your page. They contain ids and states only, never patient details.detail is a summary for logs. Read the id at its start, and don’t parse the rest: its wording can change.
Every message has source: "photon-rx". Use the resize message to size the iframe, because the iframe has no fixed height:
Sign-in
The first time, the iframe shows Sign in to Photon. Clicking it opens a popup, where the prescriber signs in with your Applicationclient_id and picks their organization. Then the iframe continues, and later loads stay signed in.
To skip the organization picker, give the client your organization, and every URL it makes carries it:
- If your iframe has a
sandboxattribute, includeallow-popups allow-scripts allow-same-origin. - If your page sends a
Cross-Origin-Opener-Policyheader, usesame-origin-allow-popups, notsame-origin.
Only the iframe can be framed
Photon allows only the/embed pages in another site’s iframe, on the domains in your credential’s allowed URLs. The Prescribe app’s other pages refuse to load in a frame anywhere else. To send a prescriber to the full app, use a deep link.