I'm currently working on a mp3 player website for a local server. It includes a "player" and a list of songs underneath.
The issue is when redirecting to another song (either via clicking or javascript redirect), it scrolls to the top of the page. It's quite annoying when I'm far down the list and clicks on a song.
It keeps the position when refreshing the page, but not with redirect.
The url looks like this:
http://192.168.1.130/music/listen.php?id=SongName
The only thing that changes during a redirect is the song name for the id.
For the redirect itself, it's either a click or JavaScript that does the action.
HTML:
<tr>
<td><a href="/music/listen.php?id=AnotherSong">AnotherSong</a></td>
<td>11.04.2019 15:52</td>
</tr>
JavaScript
window.location.href = "/music/listen.php?id=AnotherSong";
Are there any JavaScript / HTML features that keeps the scrolling position? Or would I maybe need to store the scrolling position somewhere and set the position again after the redirect has been done?