Ajax submit request in ios Safari 6 not working

After upgrading to iOS6.0, the ajax login page stopped working. It seems that the ajax post request made by jquery $ .ajax is cached in safari even after adding a random querystring parameter and sets Cache-control to "no-cache" (they were found on the network as a solution to the cache problem). The first login attempt works fine, but after logging out in the second login browser, the browser does not receive any response body from the server. headers only.

The same thing works in IOS 6 versions of GM and 5 and in all desktop browsers.

Any ideas?

+4
source share
2 answers

I just read this article in ars technica , which seems to be related to your problem. Apple seems to be optimizing Safari on iOS6.

+5
source

This section is also covered in detail here: Is Safari on iOS 6 caching $ .ajax results?

Another note, however, is not described above.

There was a useful comment re WCF, which is also applicable to ASP.NET MVC re SetCacheability applications. I recommend that these calls be limited to non-GET requests so as not to lose the cache advantage in GET.

I use the base class Controller, which inherits all my controllers for a number of reasons, and it is well established that my redefinition of initialization can handle the settings of my caching headers.

public class SmartController : Controller { ... public HttpContextBase Context { get; set; } protected override void Initialize(System.Web.Routing.RequestContext requestContext) { Context = requestContext.HttpContext; if (Context.Request.RequestType != "GET") { Context.Response.Cache.SetCacheability(HttpCacheability.NoCache); } base.Initialize(requestContext); ... } ... } 
+1
source

Source: https://habr.com/ru/post/1435912/


All Articles