I have a page with a lot of content, and when I scroll down the page and then go to another page and then go to the previous page it scrolls up. But it doesn't work only in Safari and IOS. Chrome and Android work correct and the scroll position of the previous page saves.
The code with redirect to the page when I click on some item:
goToProduct: function (event, product) {
if(this.refreshPage){
return
}
event.preventDefault();
if(this.$root.currentView !== 'product'){
userHistory.saveScrollPosition();
}
window.location.href = product.url;
}
saveScrollPosition() {
if (!history.state) {
return;
}
history.state.scrollPosition = window.scrollY ? window.scrollY : $('html, body').scrollTop();
history.replaceState(history.state, null, history.state.url);
}