How can I utilize javascript to get to a specific page position after my page refreshes?

176 Views Asked by At

I am new to javascript and more entrenched in the front-end development side. I have found some help here with my question below - Prevent automatic browser scroll on refresh - but I have a different scenerio - one that incorporates a page refresh. This example works, but once the page refreshes, the page goes back to the top,

Scenerio: Our web app asks a series of questions, state, height, weight, gender, etc. Then a calculate button is clicked which will display the results of user's answers based on rules that are set on the back end. All of the page content displays on the same page. The results side is in a disabled mode until the questions are answered and the calculate button is clicked.

Here's what currently happens: User answers questions, calculate button is clicked, spinner displays for around 5 seconds to load results from the backend. After the results load, the page refreshes and goes back to the top of the page content with all the questions that the user just answered. User now has to scroll down to view results.

Here's what I want to happen: Calculate button is clicked, page moves down to results position and stays there AFTER the page refresh.

How can I use javascript like in the link example above to get to a specific page position after the page refreshes? Any help is greatly appreciated.

0

There are 0 best solutions below