Is it possible to determine if a response returned by $.ajax was served from the browser’s cache or was fresh?
Thanks.
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.
No, that’s not possible. What you can do is to create a new URL every time (eg: by appending a random string to the URL, which is ignored by the script on the server), or by setting the response’s cache headers appropriately.
See: http://www.mnot.net/cache_docs/#CACHE-CONTROL
You might want to set
max-age,no-store,no-cache,must-revalidateor a combination of the previous.