On gists
Iframe autoheight
JavaScript
index.html
Raw
#
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<iframe id="frame" src="long.html" width="100%" height="0" frameborder="0"></iframe>
<script>
let f = document.getElementById('frame');
f.onload = () => {
console.log('nacteno');
console.dir(f.contentDocument.documentElement);
var obsah = f.contentDocument || f.contentWindow.document;
f.style.height = obsah.documentElement.scrollHeight + 'px';
};
</script>
</body>
</html>