Quick tip: Use SHIFT-refresh in your web browser

I recently posted this tip to my personal blog: Shamino's page: Quick tip: Use SHIFT-refresh in your web browser

This is a tip you may already know about, because browsers have supported the feature for many years.

If you hold down the SHIFT key while refreshing a page (e.g. type CMD-SHIFT-R or hold SHIFT when clicking the Refresh button in the tool-bar), it will tell the browser to ignore cached content when reloading the page.

This is a great way to resolve problems when something doesn’t seem to have loaded correctly. Web site managers will frequently tell you to clear your cache to solve problems, but that’s a pain in the neck. You need to dig through various screens in your browser’s preferences in order to find the button to do this, and when you do, all web pages will need to reload everything, slowing down their load times until the cache gets re-populated.

Simply holding down SHIFT while reloading is much better. It’s immediately available, so it won’t distract you from what you were doing. And it only reloads the cached content used by that page.

This feature is known to be available with Firefox (source), Chrome (source) and Microsoft Edge (source).

On Apple Safari, use the OPTION key instead of SHIFT. (CMD-SHIFT-R opens the page in Reader view). (source).

I suspect most other browsers will also support this feature.

1 Like

Thanks David! I was unaware of that tip, and can imagine many scenarios where it will be quite helpful!! :nerd_face::pray:t3:

Safari’s View menu actually tells you what modifier you need to press to load the page from the remote server rather than from cache. It’s actually opt-cmd-r. Either that or you hold opt while you click reload in Safari.

As does Edge (and I assume Chrome, since both are based on Chromium).

Firefox, however, does not put “Reload” on any menu. It’s strictly keyboard and toolbar.

Yes. I mentioned, toward the end of the post, that Safari uses CMD-SHIFT-R for reader mode, and uses CMD-OPT-R for “Reload page from origin”.

1 Like

I use an extension called Forget Me Not in Firefox, which has a popdown menu to “Clean this domain”, and another extension called Empty Cache. I’m not sure what the difference is between what those two extensions do… I think Forget Me Not does more than just empty the cache… while the tip you describe (Shift Refresh) just ignores the cache for that reload, but doesn’t delete it… as far as I know.

Anybody know more precisely what the difference between these three maneuvers is? (BTW, my use is mostly for building web pages, where I want to see the code change I just made take effect immediately. I haven’t had much success in clearing the cache when encountering somebody else’s misbehaving website; my impression is that the problem is usually deeper, related to JavaScript, or database, or architectural flaws.)

As I understand it, the cache remembers the most recent data corresponding to each URL (including the URLs for embedded/inline objects, not just the one visible in the location bar), not every version you may have downloaded. So when you do a shift-reload, the newly downloaded content should replace any cached version of the page’s URLs.

An actual cache-clear would delete all content (or all content belonging to the domain) instead of just replacing the content for the page’s URLs.

This might save some storage space in the cache directory, but I don’t think it will be much different as far as diagnosing/fixing problems goes.

I haven’t worked with cache code in a while, but I recall its being much more complicated than that. First of all, there are different kinds of caches, such as the browser cache, server cache, and a proxy server (such as a CDN) cache… and many coded instructions that can affect how they behave, which may vary depending on both the browser and the kind of web server.

I’ve only worked directly with Apache servers, but IIS, NGINX, CloudFlare’s caches, etc, all behave somewhat differently and may overlap.

One set of instructions I recall coding (years ago) involved Apache code modules like mod cache, mod cache disk, etc. Instructions you specify for them might include things like fresh, stale, freshness lifetime, expiration date, conditional modification instructions, and so on. Very complicated stuff. All of those (and far more) variables, multiplied by the Firefox extensions I use for this plus the reload or shift-reload you mentioned… adds up to a hellishly complex situation that no simple statement can encompass. Mostly I’ve had to approach it empirically, through trial-and-error more than actually understanding what all the options are really going to result in.

1 Like

Yes. I was only talking about local browser-side caches.

Using the Firefox inspector to review the request headers, I noticed that when I do a normal reload, the HTTP request headers include lines like:

If-Modified-Since: Tue, 03 Jan 2023 17:16:29 GMT
If-None-Match: "201c-5f15f3a7cd540"

Which tell the server when to send cached content vs. newly-fetched content.

When I reload with SHIFT, those headers go away and are replaced with:

Pragma: no-cache
Cache-Control: no-cache

This should take care of any server-side caching that might take place, assuming the server respects those headers.

I assume other browsers do something similar.

I quite often use right-clicking on the Safari reload icon. You get the reload without content blockers option there and if you hold down option while right-clicking you get Reload Page From Origin.

1 Like