Why does this js code work in Chrome and Safari?

I have an iframe on my index.html and this iframe is dynamic.

on my index.html I have a form that when submitted displays the results inside an iframe.

The problem is that Iframes height also needs to be dynamic for the website to look "clean."

So, on the Iframes PHP page, I have this code:

<body onload="parent.resize_iframe(document.body.scrollHeight)">

And in index.html (which is the parent in this case) I have this function:

function resize_iframe(new_height){
    byId('iframe001').style.height=parseInt(new_height) + 20 + 'px';
}

The problem here is not the function, but that Safari and Chrome believe scrollHeight is more than that.

I tried to notify scrollHeight, and nr is always around 2000 pixels in Chrome and Safari, but in other browsers it is dynamic, as it should be (500, 300, 800, etc.) ...

Any ideas?

UPDATE:

, , , iframe DOES SAFARI CHROME.

, ...

: , Chrome/Safari ScrollHeight

+3
2

, , . Safari Chrome - , webkit, . , . , google it "webkit "

0

javascript , , .

(HTML).

, jQuery.

jQuery ; .

0

Source: https://habr.com/ru/post/1767742/


All Articles