0

I have tried to solve browser cache problem using cachebuster value appended to javascript file referemce, tried to use combination of meta tag for cache control, force browser to clear cache using version no in filename, but none can lead to final solution. Breaks in between in random manner. Code is not updated without hard refresh or clear cache. Can anybody help on this?

sgajera
  • 124
  • 9
  • Have you tried changing the apache mod_expires for the file extensions in question (css, js) to 0 seconds? This can be done at the config level or in a .htaccess file. `ExpiresByType text/javascript "access plus 0 seconds"` http://httpd.apache.org/docs/current/mod/mod_expires.html – Gifford N. Apr 26 '17 at 06:49
  • Are you appending some string like version number of datetime string .. to get fresh copy of code ? – Atul Sharma Apr 26 '17 at 06:52
  • @atulquest93 Yes I have tried with datetime string as well. It doesn't work – sgajera Apr 26 '17 at 06:53
  • Along with my previous comment, even better still, try forcing the headers to expire as in this answer: http://stackoverflow.com/a/11724596/2764290 – Gifford N. Apr 26 '17 at 06:57
  • Can you show us HTTP headers of a request that doesn't work like you expect? You can use Chrome DevTools [Copy All as HAR](https://developers.google.com/web/tools/chrome-devtools/network-performance/reference#copy) feature, [Fiddler](http://www.telerik.com/fiddler) or any other web development tool . – Leonid Vasilev Apr 26 '17 at 10:29
  • @LeonidVasilyev Here is what I am using as a headers.Still doesn't get robust solution for this problem. – sgajera Jun 05 '17 at 12:24
  • @GiffordN. I have tried ExpiresByType text/javascript "access plus 0 seconds" in .htaccess files as well. It working for some of the javascript files, but not for all. – sgajera Jun 05 '17 at 12:25

0 Answers0