Is there a way in either Javascript or C# to tell if the browser that someone is using has disabled caching of static content?
I need to be able to test whether or not the browser is optimized for caching.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
UPDATE
I did a bit more investigation of the problem and you can find more detailed answer in my recent post
Note, the solution described below (initially) is not cross browser solution.
Not sure if it helps, but you can try the following trick:
1. Add some resource to you page, let’s say it will be javascript file
cachedetect.js.2. The server should generate
cachedetect.jseach time someone request it. And it should contain cache-related headers in response, i.e. if browser’s cache is enabled the resource should be cached for long time. Eachcachedetect.jsshould look like this:After that you can simply check for
cacheEnabled === trueorcacheEnabled === falseafter some period of time.