Hi guys, My site is mainly static content - so most of the time - I want my site in everyone's cache for as long as possible. I have this in my htaccess file: BUT - I'd like to force a whole site update - THEN continue caching the site. In pseudo code - IF CACHE IS OLDER THEN 15th DEC 2014 THEN RENEW CACHE IF CACHE IS NEWER OR SAME AS 15th DEC 2014 THEN LOAD FROM CACHE Is this possible? I don't mind if this is done in the header, in php, JS, but I'd rather not change my htaccess file. Thanks for the help!
you can use this code to update to the newest version of your site: // Check if a new cache is available on page load. window.addEventListener('load',function(e){ window.applicationCache.addEventListener('updateready',function(e){if(window.applicationCache.status == window.applicationCache.UPDATEREADY){// Browser downloaded a new app cache.// Swap it in and reload the page to get the new hotness. window.applicationCache.swapCache();if(confirm('A new version of this site is available. Load it?')){ window.location.reload();}}else{// Manifest didn't changed. Nothing new to server.}},false); },false); Code (JavaScript): For more info check www.html5rocks.com/en/tutorials/appcache/beginner/ Code (markup):