0

Recently i had faced a issue of javascript

my script include code

<script language="javascript"  src="/scripts/validation.js"></script>   

this is a common js file for all modules, as result this files contains some common funtions also, every time when a common function is updated for new changes of our application , that changes doesnt reflect in the application

for example

validation.js

function validateDateValues(object)
{
 some code//
}

function validateDate(val)
{
some code
}

On every update of our application, we have to change some codes in common function of js file, if i do some change in code of validateDate(val), it doesnt relect in the application.

i think problem cause due to browser cache, when a client reports this issue , we recommend them to clear the cache and use it.

please give valuable suggestion to solve this issue

user_vs
  • 913
  • 1
  • 14
  • 27
  • You could open up devloper console on chrome an in the settings go and find teh checkbox, "Disable Cache(while dev tools is open). This is good especially if you testing, but the Shift CTRL + F5 is your best bet as well – TrojanMorse Oct 28 '15 at 10:39
  • 1
    Possible duplicate of [How can I force clients to refresh JavaScript files?](http://stackoverflow.com/questions/32414/how-can-i-force-clients-to-refresh-javascript-files) – Ason Oct 28 '15 at 10:50

3 Answers3

0

Usally a "force refresh" is enough. You can achieve this by pressing the following key combination: Ctrl + F5

To know more refer this link

http://www.wikihow.com/Clear-the-Cache-in-Chrome

Domain
  • 10,694
  • 2
  • 19
  • 41
0

Whenever you do changes to your script file. Just add a ?(version without brackets) after your file source url.

Check the below link for detailed answer

How can I force clients to refresh JavaScript files?

Community
  • 1
  • 1
J Ramesh Fernandez
  • 199
  • 1
  • 6
  • 22
  • When you find another question/answer at SO, which answers the question you are answering, flag it (vote when you have enough rep. points) as a duplicate instead of answer it. – Ason Oct 28 '15 at 12:17
  • @LGSon actually i was searching for how to mark it as duplicate. But then i you did. Hereafter i will follow what you said. Thank you – J Ramesh Fernandez Oct 29 '15 at 03:13
0

This cases are mostly happens in IE browser,

For solution, you can add version parameter at the time of including JS file in application like as follow

<script src="/js/demo.js?v=1"></script>

Nex time if you make any change in js file then change that version from 1 to 2

<script src="/js/demo.js?v=2"></script>

I hope this will solve your problem for all browsers.

Alpesh Jikadra
  • 1,546
  • 1
  • 12
  • 22