Jquery mobile jQuery Mobile没有正确地重新加载我的页面

Jquery mobile jQuery Mobile没有正确地重新加载我的页面,jquery-mobile,Jquery Mobile,好吧,这很奇怪: 首先,我打开page1.html。从page1.html我通过链接转到page2.html,然后通过另一个链接返回到page1.html。这些链接只是具有相对路径的常规链接,而不是rel=“back”类型的链接 问题是:jQuery Mobile将缓存page1.html(尽管它不缓存page2.html) 如果我将rel=“external”添加到page2.html的链接中,那么page1将被刷新,但所有资源也一起被重新加载(这不是我想要的) 我只想重新加载page1.ht

好吧,这很奇怪: 首先,我打开page1.html。从page1.html我通过链接转到page2.html,然后通过另一个链接返回到page1.html。这些链接只是具有相对路径的常规链接,而不是
rel=“back”
类型的链接

问题是:jQuery Mobile将缓存page1.html(尽管它不缓存page2.html) 如果我将rel=“external”添加到page2.html的链接中,那么page1将被刷新,但所有资源也一起被重新加载(这不是我想要的)

我只想重新加载page1.html的html。我在page1.html注释中添加了
datacache=false
datadomcache=false
,但没有帮助


如何让jQuery Mobile在给定场景中不缓存page1.html?

我使用的是一个workarround,可以根据数据dom缓存属性手动删除页面。您需要为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
        }
    });

我使用的是一个Workaround,它根据数据dom缓存属性手动删除页面。您需要为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
        }
    });

非常感谢,效果很好。我想知道为什么默认情况下不包括该功能…非常感谢,它工作得很好。我想知道为什么默认情况下不包括该功能。。。