MDN suggests (if I'm reading it properly which is always a bit questionable), you can set "Cache-Control" to "only-if-cached" in the request, and it'll return a 503 if the page isn't in cached. However, I've tried doing this and I'm getting a 404 for pages that don't exist, which makes me think the page is being fetched anyway. certainly the time taken to do the fetch doesn't seem hugely different.
As for why, I'm trying to make sure the If-Modified-Since and If-None-Match headers get set appropriately on a request even after a browser restart, and that would seem to be more or less the best way (well, a lot easier than maintaining them separately)
How can I retrieve a page from the cache (if it's there) and avoid going to the network
Moderators: FranklinDM, Lootyhoof
-
thosrtanner
- Lunatic

- Posts: 465
- Joined: 2014-05-10, 18:19
- Location: UK
-
Mæstro
- Board Warrior

- Posts: 1091
- Joined: 2019-08-13, 00:30
- Location: Casumia
Re: How can I retrieve a page from the cache (if it's there) and avoid going to the network
Although this is not a direct answer, I can suggest a complement which you can use beside one, which I hope somebody else can provide. The extension Scrapbook X can save local copies of a webpage which are more easily accessed and managed.
‘Life is a fever dream Mæstro would enjoy.’
All posts 100% organic. Ash is the best letter.
What is being nice online?
Debian 10 ELTS / Official PM build
All posts 100% organic. Ash is the best letter.
What is being nice online?
Debian 10 ELTS / Official PM build
-
back2themoon
- Knows the dark side

- Posts: 3154
- Joined: 2012-08-19, 20:32
Re: How can I retrieve a page from the cache (if it's there) and avoid going to the network
The Greedy Cache extension might help? Cannot say.
-
thosrtanner
- Lunatic

- Posts: 465
- Joined: 2014-05-10, 18:19
- Location: UK
Re: How can I retrieve a page from the cache (if it's there) and avoid going to the network
wow. setting a bit without a name in an attribute that isn't documented. - it might help, yes! that's scary though. I'll try it.