mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 21:04:09 +00:00
6e74c27ea2
some website ,the page content is lazy load, the iframe-resizer seems has trouble with them.
13 lines
500 B
JavaScript
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); |