How to version MVC JavaScript includes

Posted by Ed on Stack Overflow See other posts from Stack Overflow or by Ed
Published on 2010-04-13T11:28:31Z Indexed on 2010/06/18 9:23 UTC
Read the original article Hit count: 307

Filed under:
|

I'm working with someone else's code, so I don't know the whole picture, and I don't even know MVC that well, but here's the problem...

In Site.Master there's a

<%= Html.IncludeJs("ProductPartial")%>

which produces this line in the final mark-up

<script type="text/javascript" src="/Scripts/release/ProductPartial.js"></script>

I made some changes in the JS file, but the old one is obviously cached by the browser, so the changes won't show up until the user refreshes. The usual workaround is to add a version tag at the end of the script source path, but I'm not sure how to do that in this case.

Any suggestions?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about asp.net-mvc