aboutsummaryrefslogtreecommitdiff
path: root/plugins/viewhtml/public/assets/script.js
blob: fd7a1d5be6f74e7c1af5b359b3381affecca27f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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();
	}
}