I’m not following here. That’s the way it should work by default.
If you visit https://meta.discourse.org, scroll down, click on a topic, then hit the back button, you’ll be taken back to the exact spot you were on before - there’s also an animation that triggers to let you know. This works on both desktop and mobile.
Are you experiencing something different?