When using caching for Ajax calls, the standard rule is to cache GET requests and not to cache POST requests. However Apple seems to have broken this rule in IOS 6 release. Safari seems to be aggresively caching in order to improve performance on iPad.
We noted this problem when one of our applications started failing as it wasn't calling a webservice using Ajax. We couldn't replicate the problem on a PC. So after enabling logging for the webservice, we noticed that Safari wasn't calling the webservice after first call and caching the content. The logic Safari uses that if the parameters and the value of parameters is same, then it will use cached reponse.
We tried disabling the caching by setting response headers to prevent any form of caching. Safari ignores all caching headers (Thank you apple for deviating from standards...). The only workable solution is to set of the parameters which will have a different value for every request. We have used a timestamp. This forces Safari to fetch updated content on every request.
Here is an good article which explains the problem
http://arstechnica.com/apple/2012/09/developers-claim-safari-in-ios-6-breaks-web-apps-with-aggressive-caching/
Update: 2013-01-29 : It is expected that IOS 6.1 update will contain the fix for this. IOS 6.1 is out now.
We noted this problem when one of our applications started failing as it wasn't calling a webservice using Ajax. We couldn't replicate the problem on a PC. So after enabling logging for the webservice, we noticed that Safari wasn't calling the webservice after first call and caching the content. The logic Safari uses that if the parameters and the value of parameters is same, then it will use cached reponse.
We tried disabling the caching by setting response headers to prevent any form of caching. Safari ignores all caching headers (Thank you apple for deviating from standards...). The only workable solution is to set of the parameters which will have a different value for every request. We have used a timestamp. This forces Safari to fetch updated content on every request.
Here is an good article which explains the problem
http://arstechnica.com/apple/2012/09/developers-claim-safari-in-ios-6-breaks-web-apps-with-aggressive-caching/
Update: 2013-01-29 : It is expected that IOS 6.1 update will contain the fix for this. IOS 6.1 is out now.
Comments