0

So I changed some jquery on a page in my application and it works fine etc.

But I just noticed that when I push the code to a different server and run the page on that server I need to hit ctrl + f5 to see the changes reflected. Is there a way when doing a code push to clear the cache on that page / javascript so it loads the latest version not the cached version.

2
  • it looks like your browser has cached the .js Commented May 30, 2012 at 15:35
  • yup thats it, just looking how to get around it Commented May 30, 2012 at 15:58

2 Answers 2

1

on your referenced javascript file you can add a querystring, like:

<script src="/scripts/myfile.js?v=1" type="text/javascript"></script>

whenever you change the text in the file update the query string.

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

Comments

0

You need to take a look at your js files content expiry.

One way to solve this problem is to append a dummy query string parameter to all your *.js urls and set it to the build number of your app or file modified time.

/Scripts/file.js?v=1.0.12345.0

This will ensure that each build will use new urls and you can set their content expiry to never.

Comments

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.