Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Website needs force refresh after deploy

After deploying a new version of a website the browser loads everything from its cache from the old webpage until a force refresh is done. Images are old, cookies are old, and some AJAX parts are not working.

How should I proceed to serve the users with the latest version of the page after deploy?

The webpage is an ASP.Net webpage using IIS7+.

like image 857
Germstorm Avatar asked Jun 07 '11 16:06

Germstorm


People also ask

What is a forced refresh?

Before you go straight to clearing your entire browser cache, one trick you can try is something called a 'forced refresh'. Normally, when you refresh a page, your browser still serves up the cached version of the page, rather than downloading all of the assets again.

How do you refresh a website on a server?

⇧ Shift-click the Refresh button. While pressing the Refresh button on your browser's address bar will only do a standard refresh, you can force a refresh from the server by pressing ⇧ Shift and clicking it instead. Internet Explorer users should hold ^ Ctrl and click the Refresh button.


1 Answers

You can append a variable to the end of each of your resources that changes with each deploy. For example you can name your stylesheets:

styles.css?id=1 

with the id changing each time.

This will force the browser to download the new version as it cannot find it in its cache.

like image 159
m.edmondson Avatar answered Oct 12 '22 05:10

m.edmondson