Is Safari on iOS 6 caching $.ajax results?

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

    This JavaScript snippet works great with jQuery and jQuery Mobile:

    $.ajaxSetup({
        cache: false,
        headers: {
            'Cache-Control': 'no-cache'
        }
    });
    

    Just place it somewhere in your JavaScript code (after jQuery is loaded, and best before you do AJAX requests) and it should help.

提交回复
热议问题