IE8/IE9 Ajax Cache Problem _ajax related

Source: Internet
Author: User
Tags browser cache

Introduction to Ajax

Ajax, "Asynchronous JavaScript and XML" (Asynchronous JavaScript and XML), refers to a web development technology that creates interactive Web applications.

AJAX = Asynchronous JavaScript and XML (a subset of standard generic markup languages).

AJAX is a technique for creating fast-moving web pages.

AJAX enables asynchronous updating of Web pages by making a small amount of data exchange in the background with the server. This means you can update portions of a Web page without reloading the entire page.

Step into the business:

Recently in doing a Website Login registration box, the front-end uses jquery. Because sign and login are not on separate pages, they appear as a pop-up box. So I decided to use Ajax to implement registration and login functions. I thought it could be plain sailing and found strange problems in the test.

In Chrome, FF, ie10+ test when the basic no problem, but on the ie8,9 run when the correct user name and password can not log in. At first it was thought that the session was lost, and began to spit in the background frame.

However, after the patient debugging, found that the session is not lost. This can be a nasty death to me, I have been mixed up so long even a registered login can not be? This makes me cannot help but belittle oneself, sigh life hundred states, the world impermanence. So after 1/3 moxa incense, I decided to cheer up.

After looking at my code that didn't have a few notes, I found that the URL in $.ajax was a bit strange. Although the address is correct, the intuition of the program ape and the Siege Lion tells me that the IE8 92 brothers might have been able to cache my Ajax in a romantic way. Think of here, hands suddenly some trembling, flurried in the URL after adding a timestamp.

 
 

Then clear a cache and try again, success! You can log in normally.

Check Baidu, originally in IE8 9, when the AJAX request, if the same as before request, then no longer from the server to obtain data, but directly from the local access.

In this way, in order to deal with the low version ie excessive enthusiasm, when using $.ajax can set its cache property to False (not tested),

Cache

Requires a Boolean parameter, the default is True (default is False when datatype is script), and setting to False does not load request information from the browser cache.

or set in the global (not tested)

 
 

So you don't have to worry about caching anymore.

However, caching is not set up to cause us trouble, after all, other browsers can be used normally. Therefore, to disable the information in the cache for IE8 9 separate settings.

jquery 1.9.0 after the cancellation of $.browserif ($.browser.msie&& $.browser.version== "8.0" | | $.browser.version== "9.0")) {
//do processing 
}

After the 1.9.0, you can use $.support to determine

The checked attribute of the Ie6789,input element cannot be copied//IE, after input has been replaced, the value of the previous type cannot be maintained if (!$.support.radiovalue&&!$). support.noclonechecked) {
//do processing 

$.support is mainly used for internal use of jQuery, and it doesn't feel good.

The above is a small set to introduce the IE8/IE9 under the AJAX cache problem, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.