What I would like to do is add a query string at the end of the javascript path so that whenever my application is updated to a new version, javascript is loaded. As long as the query string is the same, I want it to continue to use the cached version without the http request in order to check if the script has changed.
The way I do this in PHP is to read the CVS tag. When I create the HTML for output, I read the CVS tag and use it to add the javascript to the end of the path so that it creates a script tag that looks like this:
<script src="javascript/messages/shipments.js?TPRSAPPS-DEV2_090828145712237-BRANCH" type="text/javascript"></script>
Until the application has changed, the tag will remain the same, so the query string will also be. The browser should cache JS, and not perform a network request at all, because the validity period is a distant future. Each time the application is updated, this query string will change, and the browser should download it.
This works fine in IE8. My problem is with Firefox. Firefox caches files, but the next time I load the page, Firebug shows a 304 response, indicating that it still complied with the network request for the file and then found that it had not changed.
So my question is: does firefox ignore the expires header and javascript cache when there is a query string?
Related: what does firefox not cache? Obviously, Rails does something similar. But this does not answer my question.
Here is the answer that I am returning to this file:
https://appdev.prsx.net/~jhargett/PRSApps-Motorlog/javascript/menuReader.js?TPRSAPPS-DEV2_090828145712237-BRANCH-DIFFERENT
HTTP/1.1 304 Not Modified
Date: Mon, 03 Oct 2011 18:35:26 GMT
Server: Apache/2.2.3 (Red Hat)
Connection: close
Etag: "179010-3f8-49a9a74334200"
Vary: Accept-Encoding
"" Firebug :
Last Modified Mon Oct 03 2011 13:35:26 GMT-0500 (Central Daylight Time)
Last Fetched Mon Oct 03 2011 13:35:26 GMT-0500 (Central Daylight Time)
Expires Fri Oct 28 2011 18:33:31 GMT-0500 (Central Daylight Time)
Data Size 345
Fetch Count 12
Device disk