I'm trying to reset browser scroll position on refresh and apparently it didn't work or ain't possible with modern browsers, am I wrong?
The code:
$(window).on('beforeunload', function() {
$('html, body').scrollTop($('#scroll-to-div-id-anchor').offset().top); });
Maybe I'm handling this incorrectly and there is another way to achieve that?
I tried all variations and possible options to this code, but it didn't work on Safari and Chrome (both on desktop and, especially - mobile).