when i press F5 on my page, ga.js just loads from cache, but myscript.js gets requested and comes back with 304 (not modified). what's the magic combo here? and how do i make it load from cache without a server trip until it expires?

EDIT
i am NOT using google's stock tracking snippet. i'm using the following loading code

3 Answers
3

Without seeing the headers for when you reloaded the page it is a little hard to double check some things.

One thing I do notice is that the dates/times don't seem correct (though this may just be an artefact of how you copied and pasted your question). The response from Google's server says the Date is Thu, 01 Mar 2012 20:58:10 GMT while your js says it is Thu, 01 Mar 2012 21:20:16 GMT. If my reading of this page is correct, if your server sets Date headers that are in the future as far as your personal machine is concerned, then the calculated current_age of your cached copy will always be 0 (rounded up from a negative number). This would cause your browser to attempt to validate it by doing a conditional GET which shows up as 304 Not Modified. Google also may be slightly out of sync with your personal machine but with them the Age header is being set and this is used when available if the calculated age value is less that it.

If this is the case, make sure that your web server (and your personal machine) are syncing their time to an internet time server. Look for a regional time server pool and get your machines to sync to them.

This may not be correct, and I don't have enough rep here to comment on your original question so I have had to add it as a straight up answer.

i am actually loading the tracking script (as well as all others) asynchronously using LABjs, so there is no difference in the way they are called. i'm not using google's stock snippet. i will update the OP with my exact code.
–
leeoniyaMar 5 '12 at 18:17

a valid point. however, the jquery loaded from the cross-origin CDN gets 304-poked also. i don't see any domain favoritism coded in there, so would probably rule out LABjs as the culprit. Chromium does seem to load a lot more from cache, even on F5. original test was in FF. maybe i'll check bugzilla.
–
leeoniyaMar 5 '12 at 23:16