Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Cache problems of Ajax and IE6 and their Solutions

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you about Ajax and IE6 caching problems and solutions, the editor feels very practical, so share with you to learn, I hope you can get something after reading this article, say no more, follow the editor to have a look.

To give you a brief introduction to the Ajax and IE6 caching problem, if there is a duplicate URL when making a request with ajax, the browser will not send the request to the server, but will return it based on the same URL request result.

Ajax and IE6 caching issu

Today, some colleagues found that after the relevant business data has been modified, the pre-modified values are still displayed under IE6. But in other browsers and IE7, IE8, there is no such problem.

Reason: when making a request with ajax, if there is a duplicate URL, the browser will not send the request to the server, but will return it based on the same URL request result. The reason is that the previous request and result have been saved in the cache. If the same URL is encountered, the result will be obtained directly from the cache.

Solution:

1. Set the tools in IE6-internet options-Internet temporary files-Settings-check each newer version of the web page-set to check every time you visit this page.

2. Send a random timestamp when IE sends ajax data. That is, you just need to make the URL of each request different, such as adding milliseconds or random numbers of time (new Date (). GetTime () or Math.Random ()) to the URL for each request.

◆ in addition, there are many other solutions online:

1. Add before sending the request

XMLHttpRequest.setRequestHeader ("If-Modified-Since", "0")

Or use the post method to submit

two。 Server-side caching is disabled (server-side caching is disabled only, ajax caching is not prohibited).

Response.setHeader ("Pragma", "No-cache"); response.setHeader ("Cache-Control", "no-cache"); response.setDateHeader ("Expires", 0); these are the caching problems and solutions of Ajax and IE6. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report