1

Ok, this is odd: First I open page1.html. From page1.html I go to page2.html by link and then back to page1.html via another link. These links are just regular links with relative path and not rel="back" kind of link.

Problem is: jQuery Mobile will cache page1.html (though it doesn't cache page2.html) If I add rel="external" to the link of page2.html then the page1 is refresh, but together, all resources is also reloaded (which not what I want).

I only want the html of page1.html to be reloaded. I added data-cache=false and data-dom-cache=false to page1.html annotation but it doesn't help.

How can I have jQuery Mobile not caching page1.html with the given scenario?

4

1 回答 1

1

我正在使用基于 data-dom-cache 属性手动删除页面的解决方法。您需要为pagehide事件添加事件处理程序并检查页面数据的domCache属性

$(document).on('pagehide', function(event, ui){
          var page = $(event.target);
          var pageData = page.data(); // get all the data attributes (remove the data prefix and format to camel case)
          if(pageData.domCache == false){
              console.log("Removing Page (id: " + page.attr('id') + ", url: " + pageData.url + ")"); //Log to console for debugging
              page.remove(); // remove the page
        }
    });
于 2013-02-21T20:01:43.017 回答