How can I retrieve a page from the cache (if it's there) and avoid going to the network

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

thosrtanner
Lunatic
Lunatic
Posts: 465
Joined: 2014-05-10, 18:19
Location: UK

How can I retrieve a page from the cache (if it's there) and avoid going to the network

Post by thosrtanner » 2026-03-30, 19:26

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)

User avatar
Mæstro
Board Warrior
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

Post by Mæstro » 2026-03-30, 23:51

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

User avatar
back2themoon
Knows the dark side
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

Post by back2themoon » 2026-03-31, 10:43

The Greedy Cache extension might help? Cannot say.

thosrtanner
Lunatic
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

Post by thosrtanner » 2026-03-31, 19:51

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.