Search code examples
javascriptasp.net-mvcgoogle-chromejquery-ui-datepicker

Js File Not Updated in Chrome, After I publish website.How to Deal with it?


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?


Solution

  • 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