views:

18

answers:

1

Background: I've been using LABjs to load JS files asynchronously and in parallel, and I want to build something that takes it a step further. Part of this will involve detecting when a JS file is loaded in cache or not. So my question is:

How can I determine whether a JS file is in cache or not and in addition do so in a way that would tell the server to ignore the request?

Followup: Having the server ignore the request I think is easy/possible if I were to do an XHR and setRequestHeader('If-Modified-Since','[FAR FUTURE DATE]'), only no matter what I set, it appears the server is always returning the file. I use a regular dynamic script add, it will hit the server as well. If I didn't care about it hitting the server, I could determine if it's cached via a dynamic script load and a setTimeout threshold for onLoad to fire or something....

A: 

This is something you should configure server side.
In general it is about adding some lines in .htaccess for the js files.

Mic