本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)75k · #2754

back-forward-cache

できること

このスキルは、ブラウザが即座の戻る・進むのために、ページを保存できなくしているコードを確認します。サイト内のページへの戻りを速くしたい開発者向けです。

使う場面

  • ✓訪問者が戻るをクリックした後、ページの読み込みが遅いとき。
  • ✓unloadのリスナーや、常に実行されるbeforeunloadの確認があるとき。
  • ✓ページが復元された後に、時間に敏感なデータを更新すべきとき。

スキルのリンク

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/back-forward-cache/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/back-forward-cache/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“戻る操作が即座に動かなくなる原因がないか、私のチェックアウトのページを確認してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、unloadのリスナーと無条件のbeforeunloadの処理を探し、その処理をpagehideとpageshowに移し、変わらなければならないデータだけを更新します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Optimize pages for back/forward cache

Back/forward cache turns many browser back and forward navigations into near-instant restores because the entire page is resumed from memory instead of being rebuilt from the network. Losing bfcache eligibility makes common navigations feel far slower than they need to.

Quick Reference

  • Never add an unload listener - it is the most common bfcache blocker
  • Use pagehide and pageshow instead of assuming every navigation reloads
  • Refresh time-sensitive state when pageshow.persisted is true
  • Keep beforeunload conditional and remove it when there are no unsaved changes
  • Verify eligibility in DevTools instead of assuming a page is cacheable

Check

Review this route for back/forward cache blockers. Search for unload or unconditional beforeunload listeners, state that assumes every navigation is a full reload, and resource lifecycles that break when the page is resumed from memory.

Fix

Replace unload logic with pagehide and pageshow handlers, remove unnecessary blockers, and refresh only the time-sensitive state that must change after a bfcache restore.

Explain

Explain how the back/forward cache differs from HTTP caching, why unload blocks it, and how pageshow/pagehide should be used instead.

Code Review

Review route code, global listeners, analytics hooks, and data-refresh logic related to Optimize pages for back/forward cache. Flag exact listeners, APIs, or lifecycle assumptions that prevent a restore or leave stale state after a restore.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/performance/back-forward-cache

よくある質問

戻る・進むキャッシュとは何ですか?

ページ全体をメモリに保持して素早く再開できるようにする仕組みで、ネットワークから作り直す代わりのものだと、このスキルは説明しています。

最もよく妨げるものは何ですか?

unloadのリスナーが、最もよくある妨げだと、このスキルは説明しています。

ページが対象かどうかは、どう確かめられますか?

ブラウザの開発者ツールで、対象かどうかを確認するよう、このスキルは述べています。

詳細

作者による元の説明

Use when reviewing navigation performance, browser lifecycle events, or resume-from-memory behavior. Check the actual browser lifecycle and restore path, not only static code patterns.

repo: thedaviddias/Front-End-Checklist

人気

GitHubのスター
75k
ランキング
#2754
ライセンス
MIT
更新日
2026/10/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル