Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions packages/embed/src/js/metadata/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,26 @@ const getArchitectureFromWebGPU = async () => {
}
};

const getHostApplication = () => {
// Reason: embed runs inside an iframe on cdn.smileidentity.com, so
// window.location is always our own origin. document.referrer is the
// parent page set by the browser (origin-only under default
// strict-origin-when-cross-origin policy), which is what we want.
if (document.referrer) {
try {
const { origin } = new URL(document.referrer);
// Reason: opaque origins (about:blank, sandboxed iframes, data:) serialize as "null"
if (origin && origin !== 'null') return origin;
} catch {
// fall through to self-origin fallback
}
}
return window.location.origin;
};

export const initializeMetadata = async () => {
metadata = [];
const hostApplication = `${window.location.protocol}//${window.location.hostname}`;
addMetadataEntry('host_application', hostApplication);
addMetadataEntry('host_application', getHostApplication());

Comment on lines 227 to 230
if (
'ondeviceproximity' in window ||
Expand Down
Loading