Problem with PHP aplication updates because of the browser cache

enaqoctoe

New Member
We have an application in PHP. The problem comes when we make updates and changes in this application. Sometimes, the users don't get the last version of the application (HTML and javascript are mainly changed) because of the browser cache. Once we realized about it, we were able to include the next code in our application (We execute it before any HTML is sent to the browser)\[code\]function clean_cache(){ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" ); header("Cache: no-cache"); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache");} \[/code\]But still we have some users that have older versions of our application.We read that a possible solution is to use a javascript asking the server via ajax if there is an update. If so, force a reload. If this is the best way to solve our problem : How can we implement this solution? If you have any other possible solution we will be very happy to know it.Thanks
 
Back
Top