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

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

问题描述

尝试过...

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

似乎没有任何效果...所以目前我正在通过...解决服务器端的问题

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

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

谢谢,

塞尔希

解决方案

感谢各位的回答,尽管他们对我来说不太适合,但他们确实为我指明了找到我正在寻找的代码的方向.

这是我在这位先生的 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 中还有一个后退按钮代码,但我似乎并不真正需要它,因为我的后退按钮似乎工作得很好......

Tried...

<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()

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

Thanks,

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.

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();
  };
});

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天全站免登陆