revert to document.write again; cesiumjs doesn't like srcdoc, period. (#258)
* revert to document.write again; cesiumjs doesn't like srcdoc, period. * Update server.ts
This commit is contained in:
parent
231f23fd72
commit
bd892b6ce4
1 changed files with 11 additions and 3 deletions
|
|
@ -95,9 +95,17 @@ window.addEventListener("message", async (event) => {
|
||||||
inner.setAttribute("allow", allowAttribute);
|
inner.setAttribute("allow", allowAttribute);
|
||||||
}
|
}
|
||||||
if (typeof html === "string") {
|
if (typeof html === "string") {
|
||||||
inner.srcdoc = html;
|
// Use document.write instead of srcdoc (which the CesiumJS Map won't work with)
|
||||||
} else {
|
const doc = inner.contentDocument || inner.contentWindow?.document;
|
||||||
console.error("[Sandbox] Missing or invalid HTML content in sandbox-resource-ready notification.");
|
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 {
|
} else {
|
||||||
if (inner && inner.contentWindow) {
|
if (inner && inner.contentWindow) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue