Edgewall Software

Changes between Initial Version and Version 7 of Ticket #9936

Feb 11, 2011, 1:10:03 AM (11 years ago)
Remy Blank

9936-versioned-css-js-r10548.patch adds a query string to all CSS <link> and JavaScript <SCRIPT> URLs, of the form ?v={trac_version}. The interesting part is in chrome.py, the rest just transforms most <link> and <script> tags embedded in templates into the corresponding calls to add_stylesheet() and add_script(), respectively.

The interesting thing with using the Trac version in the query string is that:

  • Users who install from a release package (source or binary) have a version 0.x.y, and the query string change with every release.
  • Users who install from SVN have a version 0.x.ydev-r1234, and therefore the query string also changes with every update, even of a single revision.

Both Firefox and Chrome correctly cache the files, and re-get them when the version changes. Opera and IE8 display correctly, but I haven't been able to check their caching behavior. I'm pretty confident that it works correctly, though, as WordPress uses the same scheme.

Feedback and testing welcome.


  • Ticket #9936

    • Property Owner set to Remy Blank
    • Property Priority normalhigh
    • Property Milestone
  • Ticket #9936 – Release Notes

    initial v7  
     1chrome: Appended the Trac version to internal CSS and JS URLs to ensure the browser cache gets cleared on upgrade.