Ensuring Updated CSS/JavaScript on Client Side
- by Alex
I'm trying to ensure that visitors of my ASP.NET MVC website always have the most-current CSS and Javascript (and not some older cached version).
I tried to realize this by generating a seed value when the application domain starts, and automatically append it to the CSS and Javascript URLs (so now instead of /Content/All.js the link is /Content/All.js?549238 etc.).
Unfortunately I just found out by debugging via Firebug that this causes now a full download request every time (the new "seeded" response is no longer cached at all, but I only wanted the first check to download the 'updated' version, but then cache again/only check if there is a difference).
How can I achieve my goal, is there a better way of doing this? I need the client to always request the newest version, but then cache if no change happened.
Edit: This appears to be related to the fact that my page is served over SSL. I asked a follow up question here regarding enabling clientside caching with SSL.