1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

Add iframe sandboxing

This commit is contained in:
Fred Chasen 2021-10-20 20:15:50 -07:00
parent f632df7cb3
commit ab4dd46408
8 changed files with 18828 additions and 28 deletions

View file

@ -16,7 +16,8 @@ class IframeView {
layout: undefined,
globalLayoutProperties: {},
method: undefined,
forceRight: false
forceRight: false,
allowScriptedContent: false
}, options || {});
this.id = "epubjs-view-" + uuid();
@ -88,6 +89,12 @@ class IframeView {
// Back up if seamless isn't supported
this.iframe.style.border = "none";
// sandbox
this.iframe.sandbox = "allow-same-origin";
if (this.settings.allowScriptedContent && this.section.properties.indexOf("scripted") > -1) {
this.iframe.sandbox += " allow-scripts"
}
this.iframe.setAttribute("enable-annotation", "true");
this.resizing = true;