如何禁用浏览器缓存? [英] How to disable browser cache?

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

问题描述

我有一个AJAX功能(jQuery中),它更新HTML。没关系。
现在,当我在您的地址栏点击输入(刷新),我的HTML不更新(旧的内容)。
然而,当我做 CMD + R ,我的HTML始终是ok。

I have an ajax function (in jquery) which update the html. It's ok. Now, When I tap enter in the adress bar (to refresh), my html is not updated (old content). Whereas, when I do cmd + R, my html is always ok.

这是什么问题?为什么我的内容显示在您的地址栏旧的内容?

What is the problem ? Why my content shows old content from the adress bar ?

编辑:

我用负荷() jQuery中

I use Chrome et load() in jQuery

推荐答案

如果您在浏览器本身的缓存问题,你需要设置标题,以prevent缓存在服务器端的code(如PHP的,使用Java,Python .....等等)。

If you have problem with caching in the browser itself, you need to set header to prevent caching in your Server Side's Code (e.g. Php, Java, Python .....etc).

不过,如果你想避免在您的Ajax功能的缓存使用code:

But if you want to avoid caching in your Ajax Function use this Code:

 $.ajax({
              url : scriptUrl,
              type : "get", // or 'post'
              cache : false, // This is to avoid Cache in Ajax Requests
              // .........................etc
});

注意:给你的问题​​得到更清晰的答案的详细信息

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

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