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?

1

1 Answer 1

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/

2
  • 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
    Commented Aug 6, 2013 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. Commented Aug 12, 2013 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.