Click here to Skip to main content
13,504,548 members
Rate this:
Please Sign up or sign in to vote.
Hi All,
i am developing an web application when i tested it on Safari browser in IOS 6 version.On every request its fetching same cache results .
Is it a browser problem.If it not help me in clearing the cache in java script/J query.

Thanks in advance
Posted 15-Jan-13 19:58pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Have you explicitly set cache to false in ajax call?

  url: "test.html",
  cache: false,
  success: function(data){
    //some processing
Tharaka MTR 16-Jan-13 2:28am
I tried this, but it didn't work for me.
Vyacheslav Voronenko 16-Jan-13 2:35am
Ooops! I missed that it is IOS6! Apple ignores the rules, and uses it's own caching policy. Common workaround, is to add some fake unique parameter to query (for example current date and time).


Another option, like correctly mentioned A Patra - set to no-cache:

No Cache-Control or Expires headers = iOS6 Safari will cache
Cache-Control max-age=0 and an immediate Expires = iOS6 Safari will cache
Cache-Control: no-cache = iOS6 Safari will NOT cache

Tharaka MTR 16-Jan-13 2:38am
ravithejag 16-Jan-13 5:33am
thanks Vyacheslav
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

It happens when you make a httpget request.actually by default cache is set to true .you need to use some attribute like:
apply this attribute to your controller or action


here the cache duration is set to 0 and nostore property says that cached data will not be stored at client side.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You can also set the following parameters in your page so that it will not get cached in the client browser

Response.Buffer = True
Response.ExpiresAbsolute = Now().Subtract(New TimeSpan(1, 0, 0, 0))
Response.Expires = 0
Response.CacheControl = "no-cache"

Rate this: bad
Please Sign up or sign in to vote.

Solution 3

This is exactly iOS6 breaking change.

Safari on iOS6 will cache POSTs that have either no Cache-Control headers or even "Cache-Control: max-age=0".

I also experienced with this issue and fix as follows.
In your web service method, please add the following line

[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public void HelloWorld()


if you need any more information please check in following thread.[^]
ravithejag 16-Jan-13 3:38am
Thanks Tharaka
Tharaka MTR 16-Jan-13 4:09am
if you get the answer, it is best practice to mark as answer. then thread will be closed.
Rate this: bad
Please Sign up or sign in to vote.

Solution 5

use these tags in Page

<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.180417.1 | Last Updated 9 Aug 2014
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100