ScrollHeight not working since last Chrome update

I had this function for a long time, and it changed the height of the iframe change per click, but since the last update chrome, he stopped working with chrome. I get a value of 0, while on explorer or on another platform it works fine. any ideas how to make it work again?

function calcHeight() { var the_height = document.getElementById('resize').contentWindow.document.body.scrollHeight; window.alert(the_height); document.getElementById('resize').height= the_height; } 
+5
source share
1 answer

You can try to change the way the document is referenced:

 var the_height = document.getElementById('resize').contentWindow.document.documentElement.scrollHeight; 
+1
source

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


All Articles