On the caching mechanism of Ajax _ajax correlation

Source: Internet
Author: User

The caching mechanism of AJAX is the same as the caching mechanism for browsers when processing resources.

Three Simple rules:

As long as the URL is the same GET request, the browser uses the cache (and of course the server's Cache-control/expires/last-modified/etag header settings).
The browser is not cached as long as it is a POST request.
HTTPS request, the browser will not cache (most of the case, but there are exceptions, it is said that the FF browser is the exception).

Add:

Spelling a random query string in a URL allows the browser to think that this is a new request, thereby eliminating the use of caching.
Set HTTP headers in AJAX requests: if-modified-since:0, tell the server to ask for new content.

Supplementary Note:

In general, the user manually triggers the browser refresh (Windows:f5 macos:command+r), the browser ignores the resource's cache-control/expires header settings and goes to the server. This is true for both page refreshes and Ajax refreshes. But I've heard that IE doesn't follow this rule. I don't know if it's the same for all versions of IE browsers. If any heroes know this, do not hesitate to enlighten.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.