aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/public/assets/script.js
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-01-08 12:38:09 +0100
committerSimon Ser <contact@emersion.fr>2020-01-20 16:20:15 +0100
commitd745f98bb7e77e9a1841ca9f5b7c9a6046c3b794 (patch)
treec6bd7f4db58a8294c9bf71d286d0979ebd473972 /plugins/base/public/assets/script.js
parentefaf6fd4448e6e3b70f4d3cd06bf15e89d84b590 (diff)
downloadalps-d745f98bb7e77e9a1841ca9f5b7c9a6046c3b794.tar.gz
alps-d745f98bb7e77e9a1841ca9f5b7c9a6046c3b794.zip
Add polyfill for browsers not supporting srcdoc
Diffstat (limited to 'plugins/base/public/assets/script.js')
-rw-r--r--plugins/base/public/assets/script.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/base/public/assets/script.js b/plugins/base/public/assets/script.js
index 84c353e..fd7a1d5 100644
--- a/plugins/base/public/assets/script.js
+++ b/plugins/base/public/assets/script.js
@@ -1,8 +1,18 @@
var emailFrame = document.getElementById("email-frame");
if (emailFrame) {
+ // Resize the frame with its content
var resizeFrame = function() {
emailFrame.style.height = emailFrame.contentWindow.document.documentElement.scrollHeight + "px";
};
emailFrame.addEventListener("load", resizeFrame);
emailFrame.contentWindow.addEventListener("resize", resizeFrame);
+
+ // Polyfill in case the srcdoc attribute isn't supported
+ if (!emailFrame.srcdoc) {
+ var srcdoc = emailFrame.getAttribute("srcdoc");
+ var doc = emailFrame.contentWindow.document;
+ doc.open();
+ doc.write(srcdoc);
+ doc.close();
+ }
}