Is Safari on iOS 6 caching $.ajax results ?
developers banging their head against the wall on this one. found that any of the following prevents Safari on iOS 6 from caching the POST response:
- adding [cache-control: no-cache] in the request headers
- adding a variable URL parameter such as the current time
- adding [pragma: no-cache] in the response headers
- adding [cache-control: no-cache] in the response headers
solution was the following in Javascript
using the JavaScript function getTime() in the following manner:
In JavaScript:
In PHP:
jQuery:
Check for iOS 6.0 and set Ajax header like this:
ZeptoJS:
Check for iOS 6.0 and set the Ajax header like this:
Java:
Make sure to add this at the top the page before any data is sent to the client.
.NET
Or
PHP