Unfortunately, there is no event that fires when the total page height changes. Therefore, there are two possible solutions:
You can use the timer to blindly scroll down to each interval.
setInterval(function () { window.scroll(0, document.height); }, 100);
Or you can scroll the bottom every time the height changes using the "DOMSubtreeModified" event. This event is fired every time something changes in the document, so it can slow down your browser if you change the DOM frequently. This solution, however, ensures that you scroll down the page instantly when the page grows.
//scroll to bottom when anything changes in the dom tree. var height = document.height; document.addEventListener('DOMSubtreeModified', function () { if (document.height != height) { height = document.height; window.scroll(0, height); } });
source share