Invalidate browser cache after saving solution
from pvds at MatterMost:
On that note, could the following headers be added to submission pages (because I’m not seeing them now):
Cache-Control:no-cache, no-store Max-Age: 0 Expires: 0 Pragma:no-cache
When going back and forward using the browser’s history, it will cache the submission page, including the code on there, which might be outdated after a save. So if I:
Open my submission page;
make an edit and save;
go back;
go forward
my old code will be there because my browser (Firefox Developer Edition, 75.0b2 (64-bit)) did not re-fetch the page.Me:
11:49
So yes, if we would add no-cache, you cannot retrieve unsaved changes from your browser anymore. If this recovery fall back is used a lot (during exam), it might be better to not add this header11:52
Ideally, it should invalidate the cache on save. You can still recover unsaved changes using the browser cache then, but when using back+fwd after saving, it just loads the saved versionpvds:
Submitted by Elmer van Chastelet on 13 March 2020 at 11:56Baded on this answer, you could return a 304 Not Modified if the If-Modified-Since header date value is after the latest revision.
11:57
But I’m not sure if that wouldn’t introduce more issues to be honestAs to what @Stefan Hugtenburg said, sometimes the browser does not actually unload the page. In that case, unsaved changes remain. If the user navigates back to that page, the browser simply shows that page again, and the unsaved changes are still there.
Firefox does not do that though. It simply reloads the page from cache in my screencast, which uses the initial server data from the previous request.
Issue Log
Log in to post comments