TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Bounty – iOS doesn't hold my scroll position when going back to HN

2 pointsby rubyronover 3 years ago
This is a problem that&#x27;s been frustrating me here on HN when using iOS Safari on iPhone 12 Pro Max:<p>When visiting any link on HN, whether it goes to another HN page or external website, then using the Back button or back swipe to return, my scroll position is not held. The page appears to reload and I&#x27;m left at the top of the page. The only way to hold my scroll position is to open the link in a new tab with a long press.<p>This doesn&#x27;t happen on any other mobile site for me. Also doesn&#x27;t happen when using Chrome on MacOS in mobile emulation mode.<p>Have tried closing all tabs, logging out of HN, quitting browser, deleting HN Safari cache, rebooting phone, all to no avail.<p>$20 Venmo or PayPal to first commenter with a solution. :)

1 comment

WalterGRover 3 years ago
This happens to me. It may be related to hiding submissions, but I haven&#x27;t verified that. I think what&#x27;s going on is:<p>Do you click the &quot;hide&quot; links to hide submissions?<p>The visual hiding is done via Javascript when you&#x27;re viewing a page. What seems to happen is that when you hit the back button, Safari asks HN if the page has changed, and HN says that it hasn&#x27;t. This is untrue because you&#x27;ve hidden submissions. But because HN says it hasn&#x27;t changed, Safari re-displays the page it has cached in memory and restores where the browser viewport was - but doesn&#x27;t restore the DOM state, i.e. where your hidden submissions were &#x27;recorded&#x27; in the browser.<p>Hence if you&#x27;ve hidden submissions above where the viewport <i>was</i>, when those submissions reappear, it pushes the subsequent submissions down, and the viewport ends up above where you&#x27;d expect it to.<p>There&#x27;s no client-side solution for this.
评论 #28924236 未加载