I'm using this code in my Web app to go back a page:
window.history.go(-1);
It works well, but it takes users to the same vertical location they were on the page. After going back, how can I have the TOP of the page being shown instead?
I tried:
<script>
window.history.go(-1);
window.scrollTo(0, 0); // This doesn't execute.
</script>
I don't need smooth animations or transitions. The key is just making sure the command runs after going back.