0

I am reloading a specfic page . But after reloading it is jumping to the top of the page which i dont want . Is there any other way where i can jump to a specific section so that it scrolls by itself to that section after reloading.

2 Answers2

0

Js has a function document.location.reload() which stores the position. You can add an additional true parameter to force reload, but without restoring the position.

document.location.reload(true)
Harsh Rathod
  • 129
  • 1
  • 4
0

Use location.href with address hook instead of location.reload

Like this:

window.location.href = window.location.href+'#my_hoock';
First content</br>
First content</br>
First content</br>
First content</br>

<div id="my_hoock">Div for show after reload</div>

Second content</br>
Second content</br>
Second content</br>
Second content</br>
mscdeveloper
  • 2,749
  • 1
  • 10
  • 17