mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
opt:iframe set height logic restricted to most 10 seconds
This commit is contained in:
parent
9333af47e0
commit
6aedd80ec0
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue