Browser caches are useful for web browsing, but a real pain point for developers. Modern-day browsers cache front-end resources like JavaScript or CSS style sheets. They primarily do this to increase the website performance. This can be irritating though for those working in development mode and constantly modifying the JavaScript or CSS style sheets. The […]
Browser caches are useful for web browsing, but a real pain point for developers.
Modern-day browsers cache front-end resources like JavaScript or CSS style sheets. They primarily do this to increase the website performance. This can be irritating though for those working in development mode and constantly modifying the JavaScript or CSS style sheets. The only way to see these changes is by doing a hard refresh or clearing the cache of the browser.
A hard refresh is a way of clearing the browser's cache for a specific page, to force it to load the most recent version of a page. Sometimes, when changes are made to the website, they don't register immediately due to caching. A hard refresh will usually fix this, though occasionally completely clearing the cache is necessary.
How to Hard Refresh in Various Browsers
A hard refresh in Chrome can be done by using the following short cut keys:
Different operating systems and browsers use different commands and shortcuts. For Windows in Chrome or Edge, the keyboard shortcut Ctrl + F5 (or Ctrl + Reload) refreshes. For Mac, hold Cmd+Shift+R or Shift+Reload. Most browsers also have a refresh button next to the URL.
Ctrl + F5 is the shortcut to trigger a refresh, which will force the page to reload. To make the browser refresh without relying on the cache, use Shift + Ctrl + F5. This triggers a “hard refresh”, so the browser pulls up the newest version of a web page.
Safari is easy to refresh.
Safari for Mac: Simply right-click on “Safari” at the top left of the screen and select “Empty Cache”. Confirm your choice, then reload the page.
Safari for Windows: Click the “Alt” key to reveal the menu bar. Select “Edit” – “Empty Cache”. Then confirm selection.
A hard refresh forces a page to reload without relying on the cache. It does not clear the cache or the cookies. To do so, you must go through the Control Panel’s Internet Options (or Safari’s Preferences), then select the option to delete Browsing History or Website Data, including cookies.
Ctrl + R is considered a soft refresh that reloads the page from the cache. A hard refresh ignores the cache and requests a new set of pages from the server, which ensures any updates are reflected. To do a hard refresh, press Shift + Ctrl + R.
Access Chrome Developer Tools by clicking F12. After accessing these tools, right-click on the refresh button and you will get a dropdown menu. There you get the option of choosing a hard refresh or clearing the cache and doing a hard refresh automatically.
If you run a hard refresh and see that pages are showing new information, it’s wise to clear your cache. You can do this by navigating to the Control Panel—>Internet Options/Settings –> General Tab – >Browsing History.
Then select the delete or settings button.
Browsers cache front-end resources to improve website performance such as HTML, JavaScript, CSS, and images. However, the cache may not reflect the most recent version of a web page. Clearing the cache prompts your browser to pull a fresh record for the web page.
Most modern browsers do cache JavaScript files. This is standard practice for browsers as it ensures an optimized loading experience. Cached items such as JavaScript will usually be served from the browser's cache instead of making another request for a resource that has already been retrieved.
To refresh a cache, use Ctrl + F5. You can also do a hard refresh using Shift + Ctrl + F5. Apple users replace Ctrl with Cmd. Linux just needs F5.
The cache can also be cleared manually through the Control Panel or Preferences Menu->Internet Settings/Options->Clear Browsing History/Website Data
Blog was originally published in March 2015, updated in November 2023.