Is Safari on iOS 6 caching $.ajax results? post Cache

Posted zzfx

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Is Safari on iOS 6 caching $.ajax results? post Cache相关的知识,希望对你有一定的参考价值。

https://stackoverflow.com/questions/12506897/is-safari-on-ios-6-caching-ajax-results

Since the upgrade to iOS 6, we are seeing Safari‘s web view take the liberty of caching $.ajaxcalls. This is in the context of a PhoneGap application so it is using the Safari WebView. Our $.ajax calls are POST methods and we have cache set to false {cache:false}, but still this is happening. We tried manually adding a TimeStamp to the headers but it did not help.

We did more research and found that Safari is only returning cached results for web services that have a function signature that is static and does not change from call to call. For instance, imagine a function called something like:

getNewRecordID(intRecordType)

This function receives the same input parameters over and over again, but the data it returns should be different every time.

Must be in Apple‘s haste to make iOS 6 zip along impressively they got too happy with the cache settings. Has anyone else seen this behavior on iOS 6? If so, what exactly is causing it?


The workaround that we found was to modify the function signature to be something like this:

getNewRecordID(intRecordType, strTimestamp)

and then always pass in a TimeStamp parameter as well, and just discard that value on the server side. This works around the issue. I hope this helps some other poor soul who spends 15 hours on this issue like I did!

以上是关于Is Safari on iOS 6 caching $.ajax results? post Cache的主要内容,如果未能解决你的问题,请参考以下文章

Check if a configuration profile is installed on iOS

IO is frozen on database xxx, No user action is required

6.安装pyhook报错is not a supported wheel on this platform

如何在 iOS 上仅将 javascript 函数定位到 Safari < 6.0

全屏api HTML5和Safari(iOS 6)

带有 iOS 8(Xcode 6)的 iOS 模拟器未显示在 Safari 开发菜单中