Call (877) SITE-OPT (748-3678)

Code: If modified since

Chapter 8 - Ajax Optimization

Another way to prevent caching is use the XHR objectís method, setRequestHeader( ), to set the If-Modified-Since in a request to a date far in the past so that the request will appear to need to be refetched:

xhr.setRequestHeader("If-Modified-Since", "Tue, 14 Nov 1995 03:33:08 GMT");

Developers tend to prefer this method because it does not rely on changing the URI and you can do it without any server-side modifications. There is one problem with these suggestions, however. They do not optimize Ajax in any way other than making it work. We should want to use the browser cache!

Copyright © 2002-2017 Website Optimization, LLC. All Rights Reserved - Free website speed test - Privacy Policy
Last modified: February 19, 2009.

Follow us on: Twitter, Google+, Facebook, Linked In