Skip to content
Merged
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
14 changes: 11 additions & 3 deletions examples/basic-host/src/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,17 @@ window.addEventListener("message", async (event) => {
inner.setAttribute("allow", allowAttribute);
}
if (typeof html === "string") {
inner.srcdoc = html;
} else {
console.error("[Sandbox] Missing or invalid HTML content in sandbox-resource-ready notification.");
// Use document.write instead of srcdoc (which the CesiumJS Map won't work with)
const doc = inner.contentDocument || inner.contentWindow?.document;
if (doc) {
doc.open();
doc.write(html);
doc.close();
} else {
// Fallback to srcdoc if document is not accessible
console.warn("[Sandbox] document.write not available, falling back to srcdoc");
inner.srcdoc = html;
}
}
} else {
if (inner && inner.contentWindow) {
Expand Down
Loading