Is Safari on iOS 6 caching $.ajax results?

前端 未结 25 1439
轮回少年
轮回少年 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:02

    I just had this issue as well in a PhoneGap application. I solved it by using the JavaScript function getTime() in the following manner:

    var currentTime = new Date();
    var n = currentTime.getTime();
    postUrl = "http://www.example.com/test.php?nocache="+n;
    $.post(postUrl, callbackFunction);
    

    I wasted a few hours figuring this out. It would have been nice of Apple to notify developers of this caching issue.

提交回复
热议问题