Add a note about back button and no-cache by tunetheweb · Pull Request #44575 · mdn/content · GitHub
Skip to content

Add a note about back button and no-cache#44575

Merged
hamishwillee merged 6 commits into
mdn:mainfrom
tunetheweb:no-cache-back-button
Jul 2, 2026
Merged

Add a note about back button and no-cache#44575
hamishwillee merged 6 commits into
mdn:mainfrom
tunetheweb:no-cache-back-button

Conversation

@tunetheweb

@tunetheweb tunetheweb commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Description

Add a section to explain no-cache doesn't mean browsers will always revalidate.

Motivation

Developers are often confused when browsers reuse no-cache pages when they expect them to reload. For example:

This came up again in an internal discussion and we realised this is not documented anywhere.

Additional details

Chrome and Firefox does this as can be seen from this test page.

Safari is difficult to confirm as they agressively use bfcache and everything I've tried to force it not to do that fails. Only no-store stops bfcache from being used by but that is not what I'm trying to test!

Related issues and pull requests

@tunetheweb tunetheweb requested a review from a team as a code owner June 25, 2026 09:38
@tunetheweb tunetheweb requested review from hamishwillee and removed request for a team June 25, 2026 09:38
@github-actions github-actions Bot added Content:HTTP HTTP docs size/xs [PR only] 0-5 LoC changed labels Jun 25, 2026
@tunetheweb

Copy link
Copy Markdown
Contributor Author

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Preview URLs (2 pages)

External URLs (2)

URL: /en-US/docs/Web/HTTP/Guides/Caching
Title: HTTP caching


URL: /en-US/docs/Web/HTTP/Reference/Headers/Cache-Control
Title: Cache-Control header

(comment last updated: 2026-07-02 23:58:01)

@github-actions github-actions Bot added size/s [PR only] 6-50 LoC changed and removed size/xs [PR only] 0-5 LoC changed labels Jun 29, 2026
@hamishwillee

hamishwillee commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Thanks @tunetheweb - very useful. I've subedited a little to my taste - mostly because I wanted to be even more direct about the unexpected case being the history navigations. I also duplicated the note in Cache-Control, because I think people might also search there.

  1. Are you happy with those changes
  2. Is there anywhere else we should highlight this? I was wondering if maybe also in https://developer.mozilla.org/en-US/docs/Web/API/History_API ?

@fergald

fergald commented Jun 29, 2026

Copy link
Copy Markdown

I could be wrong but I thought this also impacted max-age. Someone said we behave like force-cache here

@tunetheweb

tunetheweb commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @hamishwillee . I wasn't loving your last sentence (it seems to imply using back DOES use the HTTP cache outside of bfcache), so tweaks that a little further.

I don't think this needs to be on the History API page. It doesn't discuss other caching directives. So think these two pages are sufficient.

PTAL and merge if good!

@fergald I added a similar comment to max-age and must-revalidate sections. It's a little repetitive but think that's the best way.

Comment thread files/en-us/web/http/guides/caching/index.md Outdated
@hamishwillee

hamishwillee commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

@hamishwillee hamishwillee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM to me.

@tunetheweb tunetheweb left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @hamishwillee , I've two final suggestions.

WDYT? If good then can merge.

Comment thread files/en-us/web/http/guides/caching/index.md Outdated
Comment thread files/en-us/web/http/reference/headers/cache-control/index.md Outdated
Co-authored-by: Barry Pollard <barrypollard@google.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>

@hamishwillee hamishwillee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tunetheweb

@hamishwillee hamishwillee merged commit eff8aa0 into mdn:main Jul 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:HTTP HTTP docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants