summaryrefslogtreecommitdiff
path: root/lib/epub.js/src/managers/views/iframe.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/epub.js/src/managers/views/iframe.js')
-rw-r--r--lib/epub.js/src/managers/views/iframe.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/epub.js/src/managers/views/iframe.js b/lib/epub.js/src/managers/views/iframe.js
index 76b2c1d..e20e54d 100644
--- a/lib/epub.js/src/managers/views/iframe.js
+++ b/lib/epub.js/src/managers/views/iframe.js
@@ -16,7 +16,9 @@ class IframeView {
layout: undefined,
globalLayoutProperties: {},
method: undefined,
- forceRight: false
+ forceRight: false,
+ allowScriptedContent: false,
+ allowPopups: false
}, options || {});
this.id = "epubjs-view-" + uuid();
@@ -88,6 +90,15 @@ 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.iframe.sandbox += " allow-scripts";
+ }
+ if (this.settings.allowPopups) {
+ this.iframe.sandbox += " allow-popups";
+ }
+
this.iframe.setAttribute("enable-annotation", "true");
this.resizing = true;
@@ -221,7 +232,7 @@ class IframeView {
this.lock("both", width, height);
} else if(this.settings.axis === "horizontal") {
this.lock("height", width, height);
- } else {
+ } else {
this.lock("width", width, height);
}
@@ -816,6 +827,11 @@ class IframeView {
this.stopExpanding = true;
this.element.removeChild(this.iframe);
+ if (this.pane) {
+ this.pane.element.remove();
+ this.pane = undefined;
+ }
+
this.iframe = undefined;
this.contents = undefined;