I am willing to create a Chrome Extension which alerts the user if the option Disable Cache
is disabled because one could run unwillingly against the cache.
Is there a way to measure in javascript (maybe Chrome Extensions API?) if the Chrome DevTools option Disable Cache
is active?
Is there a certain header added to requests?
Asked
Active
Viewed 107 times
1

Quisse
- 646
- 1
- 6
- 24
-
You can inspect the requests in devtools network panel. I see `cache-control: no-cache` header there so it should be possible to detect it using chrome.webRequest API. Read the documentation and look for examples on using the API if needed. – wOxxOm Jan 17 '20 at 09:44
-
Well I can't seem to find proper documentation about the `Disable Cache` option. Also over here it's the `Pragma: no-cache` header. Chrome 79.0.3945.117 – Quisse Jan 17 '20 at 09:50
-
Oh ok, they're both there. https://stackoverflow.com/questions/10314174/difference-between-pragma-and-cache-control-headers – Quisse Jan 17 '20 at 10:00
-
There's no documentation for the option, I meant chrome.webRequest's documentation. – wOxxOm Jan 17 '20 at 10:01
-
1Ok. I wanted to be sure that headers are sufficient to rely on. Shall I answer the question or close? – Quisse Jan 17 '20 at 10:06
-
Yeah this might come useful later, as @wOxxOm said, post something what you came up with :) – VilleKoo Jan 17 '20 at 14:43
1 Answers
0
One can detect the cache-control: no-cache
header via the chrome.devtools.network
api with the .onRequestFinished
event.

Quisse
- 646
- 1
- 6
- 24