opt:iframe set height logic restricted to most 10 seconds

This commit is contained in:
Xiao YiFang 2022-09-05 20:17:00 +08:00
parent 9333af47e0
commit 6aedd80ec0

View file

@ -1,5 +1,12 @@
setInterval(function () {
//in some cases ,the website in iframe will load result after document has been loaded. the height will continue to change.
var start_time=new Date().getTime();
var interval = setInterval(function () {
var end_time=new Date().getTime();
//for 10 seconds.
if(end_time-start_time>=10000){
clearInterval(interval);
}
const body = document.body;
const html = document.documentElement;
@ -10,4 +17,4 @@ setInterval(function () {
console.log("iframe set height to " + height);
parentIFrame.size(height);
}
}, 500);
}, 500);