prevent的iOS 6从缓存Ajax的POST请求 [英] Prevent iOS 6 from Caching Ajax POST Requests
问题描述
可能重复:
是Safari浏览器在iOS 6缓存$阿贾克斯的结果?
我有一个正常运行在Android和iOS的混合应用程序中使用的PhoneGap
。但是,当我在的iOS 6开始测试我注意到,我没有收到服务器的数据,我的大多数AJAX调用 - 而不是我正从previous Ajax调用缓存中的数据。
I have a hybrid application using PhoneGap
that runs fine on Android and iOS. But when I started testing in iOS 6 I noticed that I am not getting server data for most of my ajax calls - instead I was getting the cached data from previous ajax calls.
到目前为止,我已经尝试了以下选项来禁用缓存 -
So far I have tried the following options to disable cache -
- 在包括时间戳作为查询字符串参数
-
$ ajaxSetup({缓存:假});
- 在Ajax调用
无缓存=真
-
$。阿贾克斯prefilter(功能(选项,originalOptions,jqXHR){ options.data = 。jQuery.param($扩展(originalOptions.data || {},{时间戳:新 。日期()的getTime()})); });
- Include a timestamp as query string parameter
$.ajaxSetup({ cache: false });
- Inside the ajax call
no-cache = true
$.ajaxPrefilter(function (options, originalOptions, jqXHR) { options.data = jQuery.param($.extend(originalOptions.data||{}, { timeStamp: new Date().getTime() })); });
但这些似乎是工作。我调用Java类的行动从我的Ajax调用 - ?你认为这事做,为什么这些方法上面列出的失败原因
But none of these seems to be working. I am invoke Java action classes from my ajax calls - will it have something to do with the reason why the methods listed above are failing?
推荐答案
阅读这个线程
您可以禁用Web服务器级别,并使用时间戳在URL中的缓存。
You could disable the caching on webserver level and by using timestamps in the URL.
这篇关于prevent的iOS 6从缓存Ajax的POST请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!