Uploaded image for project: 'VIVO'
  1. VIVO
  2. VIVO-1405

Defeat browser cacheing for new versions of JavaScript and CSS files.


    • Type: Improvement
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: v2.0.0
    • Component/s: None
    • Labels:
    • Attachments:
    • Comments:


      When a site upgrades to a new version of VIVO, there may be functional changes to JavaScript or CSS files that will not be picked up by the browser because the browser cache contains an older version of the "same" file.

      One solution would to tell all users to refresh the cache on their browsers, but this is not practical.

      Instead, note that links to both scripts and stylesheets are, for the most part, inserted into the HTML by the ${scripts}, ${headScripts} and ${stylesheets} Freemarker variables, which are implemented by edu.cornell.mannlib.vitro.webapp.web.templatemodels.Tags

      Modify edu.cornell.mannlib.vitro.webapp.web.templatemodels.Tags to add a "?version=xxxx" query string to the URL of the script or stylesheet, where "xxxx" is an arbitrary string based on the last-modified-date of the file being served.

      The result of this is that when a new version of VIVO is deployed, the HTML will contain a new "?version=xxx" string for each script or stylesheet, so the browser will not use the cached version.

      A pleasant side effect is that developers will not need to refresh the browser cache either, when modifying scripts or stylesheets.




            • Assignee:
              j2blake Jim Blake
              j2blake Jim Blake
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: