goldendict-ng/scripts/iframe-defer.js

13 lines
500 B
JavaScript
Raw Normal View History

setInterval(function () {
//in some cases ,the website in iframe will load result after document has been loaded. the height will continue to change.
const body = document.body;
const html = document.documentElement;
const height = Math.max(body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight);
if ('parentIFrame' in window) {
console.log("iframe set height to " + height);
parentIFrame.size(height);
}
}, 500);