Talking about the Ajax cache mechanism and the Ajax Cache Mechanism

Source: Internet
Author: User

Talking about the Ajax cache mechanism and the Ajax Cache Mechanism

The cache mechanism of Ajax is the same as that of the browser when processing resources.

Three simple rules:

As long as the GET request is the same as the URL, the browser will use the Cache (of course, you also need to check the settings of the Cache-Control/Expires/Last-Modified/ETag header of the server ).
As long as it is a POST request, the browser will not cache it.
Https requests are not cached by the browser (this is the case in most cases, but there are exceptions. It is said that the FF browser is an exception ).

Supplement:

If a random query string is entered in the URL, the browser determines that this is a new request and does not use the cache.
Set the Http header: If-Modified-Since: 0 in the Ajax request to tell the server to request new content.

Note:

Generally, when you manually trigger browser refresh (windows: F5 MacOS: command + R), the browser ignores the Cache-Control/Expires header settings of the resource and connects to the server. This is true for both page refresh and Ajax refresh. However, I have heard that IE does not follow this rule. I don't know if all Internet Explorer versions are like this. If any of you know this, please kindly advise.

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.