Is Safari on iOS 6 caching $.ajax results?

前端 未结 25 1022
轮回少年
轮回少年 2020-11-22 09:34

Since the upgrade to iOS 6, we are seeing Safari\'s web view take the liberty of caching $.ajax calls. This is in the context of a PhoneGap application so it is

25条回答
  •  抹茶落季
    2020-11-22 10:01

    I found one workaround that makes me curious as to why it works. Before reading Tadej's answer concerning ASP.NET web service, I was trying to come up with something that would work.

    And I'm not saying that it's a good solution, but I just wanted to document it here.

    main page: includes a JavaScript function, checkStatus(). The method calls another method which uses a jQuery AJAX call to update the html content. I used setInterval to call checkStatus(). Of course, I ran into the caching problem.

    Solution: use another page to call the update.

    On the main page, I set a boolean variable, runUpdate, and added the following to the body tag:

    
    

    In the of helper.html:

    
    
    

    So, if checkStatus() is called from the main page, I get the cached content. If I call checkStatus from the child page, I get updated content.

提交回复
热议问题