5

I have a website that i did some time ago now they request some new features and i did some changes in some javascript files, but when i publish the clients that use the IE have problems with cache so in they browser they have old version of javascript. How can i clear the client cache so when they visit website they use latest javascript files that i modify.

1 Answer 1

4

When you refer your javascript file append a version number also to the end of the file as a query string. Something like

<script src="yourjsfile?version=1.0" type="text/javascript"></script>

This will refer to a new url which won't be present in the cache and the browser will download the latest file.

Sign up to request clarification or add additional context in comments.

3 Comments

Suppose, it would be better to use timespan instead of version number here
No, need to use timespan. Using timespan will always load the file from server. Here when the file is changed then only the new file has to be downloaded.
Yep, sure. The only thing I wanted to mention is not to forget to change version query parameter (timespan will do it automatically but as you mentioned above the file will be always load from server).

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.