IE bug Ajax request 304 Solution

Source: Internet
Author: User
Tags random seed

After opening the debugging tool, the reason is clear: the Ajax returned result http304... each request is cached, and chrome and other browsers normally return 200.

 

 

[Solution]

Ajax requests under IE are cached Based on IP addresses and request routes, so the simplest method is as follows:

1. When a request is sent, a timestamp or random seed is automatically added at the end of the request link.

As above:/home/getmusic? Id = 1 + timestamp, which can be easily solved

2. Since it is cached, it will not be cached.

Front-end page disable cache: <meta HTTP-EQUIV = "Pragma" content = "no-Cache">

Front-end Ajax disabling Caching:

Cache parameters for Ajax requests: Required Boolean parameters. The default value is true (when datatype is script, the default value is false ). Setting false does not load request information from the browser cache.

Backend:

. Net: Response. cachecontrol = "no-Cache ";

PHP: Header ("cache-control: No-cache, must-revalidate ");

Header ("Pragma: No-Cache ");

 

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.