TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

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

2 点作者 rubyron超过 3 年前
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

WalterGR超过 3 年前
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 未加载