I need to detect if a user is scrolled to the bottom of a page. If they are at the bottom of the page, when I add new content to the bottom, I will automatically scroll them
const handleScroll = () => { if (Math.round(window.scrollY + window.innerHeight) >= Math.round(document.body.scrollHeight)) { onScroll(); } };
This code worked for me in Firefox and IE as well.