As Chinmayee points out, scrolling programmatically is fairly simple. The other part of it is how to record the scroll position before the reload.
I would try an unload handler to write a cookie to record the current scroll position (document.getElementById("invoice_incomplete").scrollTop
), but my guess that unload is too late, and not all browsers will succeed in writing the cookie. So probably onbeforeunload is the better event to go with.
So it would be something like this:
window.onbeforeunload = function() {
document.cookie = "invoiceScrollPos=" + (document.getElementById('invoice_incomplete').scrollTop) + ";path=/";
}
Then after the page reloads, read the value of that cookie and set the scrollTop
.
One (probably) undesirable side effect of this approach is that if the user leaves this page, then returns to it later in the same browser session, the scroll position will be restored to what it was before. To address that, you can add an expiration date to the cookie that is perhaps 1 minute after the cookie was created.