File size: 613 Bytes
b6bd94d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;

    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); 
    }
    else {
        clearInterval(interval);
    }
}, 500);