goldendict-ng/scripts/iframe-defer.js
Xiao YiFang 6e74c27ea2 opt:iframe height auto resize
some website ,the page content is lazy load, the iframe-resizer seems has trouble with them.
2022-09-04 19:03:27 +08:00

13 lines
500 B
JavaScript

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);