如何在jQuery Mobile UI中禁用缓存 [英] How does one disable Caching in jQuery Mobile UI

查看:212
本文介绍了如何在jQuery Mobile UI中禁用缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试...

<div data-role="page" data-cache="30"> 
<div data-role="page" data-cache="never">
<div data-role="page" data-cache="false"> 
<div data-role="page" cache="false">

没有什么可以工作......所以目前我正在解决服务器上的问题 - 通过......

Nothing seemes to work... so at the moment I'm fixing the problem on the server-side via...

.'?x='.rand()
.'&x='.rand()

我不想仅仅通过缓存来禁用AJAX。必须有更好的方法......我错过了什么吗?

I don't want to disable the AJAX just the caching. There has to be a better way though... am I missing something?

谢谢,

Serhiy

推荐答案

谢谢你们的答案,尽管他们对我不起作用,但他们确实指出了我的方向找到我要找的代码。

Thank you for the answers guys, and even though they didn't quite work for me they did point me in the direction to find the code I was looking for.

这是我在这位绅士的Github Gist上找到的代码。

This is the code that I found on this gentleman's Github Gist.

https://gist.github.com/921920

jQuery('div').live('pagehide', function(event, ui){
  var page = jQuery(event.target);

  if(page.attr('data-cache') == 'never'){
    page.remove();
  };
});

该Gist中还有一个后退按钮代码,但我似乎并不需要它因为我的后退按钮似乎工作得很好......

There is also a back button code in that Gist, but I don't seem to need it really as my back button seems to work just fine...

这篇关于如何在jQuery Mobile UI中禁用缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆