Haven’t figured out how to move this to “Help” category without tampering with the DB which I’d avoid.
Anyway, instead of window.scrollTo(0, 0) try document.body.scrollTop = document.documentElement.scrollTop = 0.

This will not work with Layouts, so let me know if this is the case as it deserves a more detailed answer.