0

When I do some updates in my .js, my clients browser aLways get the old version and they have to press Ctrl + F5 to clean the cache and then the browser can download the new version.

I know that browsers, once cached, doesn't download the doc with the same name. I have about 100 web pages with the js and my question is: -Do I have to create versions of my js, like doc.1.3.js? If yes, in this case, I have to upload my 100 pages every time I change the js. -How do you, developers, threat this issue, considering a easy way to maintence and control version?

MaVRoSCy
  • 16,907
  • 14
  • 76
  • 116
Onaiggac
  • 541
  • 5
  • 21

1 Answers1

1

google has a good write up on Caching, specifically, using HTTP headers Cache-Control: max-age, and Last-Modified: to get the browser to check, and get the latest files only when needed. In your case, and in most peoples cases, whenever it was last-modified.

https://developers.google.com/speed/docs/best-practices/caching

If you need more info on HTTP headers, I've found this helpful in the past: http://net.tutsplus.com/tutorials/other/http-headers-for-dummies/

  • These materials are great. Do you know if I have to control the cache with my classic ASP ou with some code in Javascript doc? – Onaiggac Aug 06 '13 at 20:15
  • while you can retrieve HTTP headers from a server via client side javascript, you'll need to set the caching variables on the server side. I'm not familiar with classic ASP, but you can start there, or with your web server's config. – Alex Hornbake Aug 12 '13 at 07:57