There was a requirement before that to determine whether the web page in the iframe scrolled to the bottom to trigger the event. I found a lot of information online, which was said to be under the current page, so I simply studied it myself and found a solution.
clientHeight: The height of this element, the height that occupies the entire space
offsetHeight: refers to the height of the element content
scrollTop: It can be understood as the length of the scroll bar that can be scrolled
The following is the source code
The code copy is as follows:
<iframe src="~/Files/3.html" id="iframepage" onload="func()"></iframe>
<script type="text/javascript">
function func() {
var ifm = document.getElementById("iframepage");
ifm.height = window.document.body.clientHeight - 100;
}
<!--There are compatibility issues in chrome, and there is no problem with FF and IE10. It is said online that chrome accesses iframes in a server environment, and I don’t know what the situation is-->
window.document.getElementById("iframepage").contentWindow.onscroll = function aaa() {
var ifm = document.getElementById("iframepage").contentWindow.document.documentElement;
if (ifm.scrollTop == ifm.scrollHeight - ifm.clientHeight) {
alert("The end");
}
}
</script>