[whatwg/fetch] Add ability to opt-out of back-forward cache (Issue #1917)

KthProg created an issue (whatwg/fetch#1917)

### What problem are you trying to solve?

Lots of fetch GET requests should be cached, but should not be pulled from previously cached versions on back navigation, e.g. a user's cart. Being able to provide a hint to the fetch API/browser that a GET request should not be bf-cached would be very helpful. Right now the workaround is to listen for a page show event that is persisted, and then trigger the API requests that should not be bf-cached manually. This is fine but ugly and confusing.

Cache headers and no cache settings for the Fetch API are ignored by some browsers when using bf navigation, in particular Safari. I believe there should be a standard way to tell the browser that a fetch request should not be pulled from the bfcache.

### What solutions exist today?

- You can set cache-control headers, but most browsers seem to ignore these when using bfcache
- You can set `cache: 'no-store'` on the fetch request, but Safari definitely ignores this when using bfcache
- You can listen to the pageshow event and check if the page was persisted, and trigger your API request, but you have to do this manually for every request you want to re-run

### How would you solve it?

I would add an additional bfcache property to the request init object, with values like 'no-store'.

### Anything else?

See this related issue:
https://github.com/whatwg/html/issues/5744

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1917
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/1917@github.com>

Received on Wednesday, 1 April 2026 17:31:36 UTC