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:
parent
f632df7cb3
commit
ab4dd46408
8 changed files with 18828 additions and 28 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue