diff --git a/src/impl/LessonEngine.js b/src/impl/LessonEngine.js index 3604e16..e836b2d 100644 --- a/src/impl/LessonEngine.js +++ b/src/impl/LessonEngine.js @@ -216,18 +216,18 @@ export class LessonEngine { iframe.style.height = "100%"; iframe.style.border = "none"; iframe.title = "Preview"; + iframe.setAttribute("sandbox", "allow-scripts"); const container = document.getElementById(previewContainer || "preview-area"); container.innerHTML = ""; container.appendChild(iframe); - const iframeDoc = iframe.contentDocument || iframe.contentWindow.document; - iframeDoc.open(); + let html; if (mode === "html" || mode === "playground") { // For HTML/playground mode, user code IS the HTML content (may include