1

Hello StackOverflow ppl I got Problem with javascript file in ASP MVC Website.

I am using jquery Datepickers, which i have in my core.js file.

When i updated jquery Datepicker dateformat to 'dd/mm/yy', in my core.js and uploaded web site on IIS. Users See Old DateFormats in CHROME. (Problem not exists in Firefox or IE.just one refresh helps.)

In Chrome I Cleaned Cache and problem was gone but i cant tell 3000 users one by one to clean cache...

Any Solutions?

R01
  • 301
  • 2
  • 4
  • 14

3 Answers3

3

Another good solution to trick any browsers that don't like to listen to cache expiration is to make it append something like ?v=versionumber to the js URL as the browser will treat this like a new URL.

So in other words every time you make changes increment the version number it appends and this will ensure that browsers re-download the JavaScript.

Example:

someURL/js/jquery.js?v=3.1.1

If you updates would change to:

someURL/js/jquery.js?v=3.1.2

Deckerz
  • 2,585
  • 12
  • 32
0

You will have to specify the cache expiration with whatever caching agent your using.

Lars Peterson
  • 1,439
  • 1
  • 8
  • 26
0

The browser might be caching the JS/CSS files etc and you need to set the meta tag for cache clearance

Examples:

    <meta http-equiv="cache-control" content="max-age=0" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="expires" content="Tue, 01 Jan 1910 4:00:00 GMT" />
    <meta http-equiv="pragma" content="no-cache" />
Naveed Kamran
  • 433
  • 1
  • 4
  • 15