问题标签 [no-cache]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
caching - Tomcat 正在为 JS 和 CSS 文件设置无缓存
太令人沮丧了。:P
真的希望这些缓存在用户的浏览器上,但它正在设置这个。
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
我该如何阻止这个?
我尝试在我们的设置中查找与缓存相关的任何内容。根据文档,使用所有默认值,这意味着它是允许的。像 JS 和 CSS 这样的静态文件有区别吗?
编辑:我注意到一些 JS 文件被允许缓存,因为 Chrome 说它们是“从缓存中检索的”。然而,没有 CSS 文件。
asp.net - Why would Response.Cache.SetNoStore() not work in a class that derives from System.Web.UI.Page
I work on registration sites as part of my job and patterns appear that I try and farm out to a central BasePage
DLL. Here I have created useful and reusable methods in the past, Such as methods to help sending emails and Dependency Injection setups for Ninject.
It might be useful to note that BasePage
is a reference that I add to a website.
In this case, I wanted the session to expire, so that when someone uses the browser back event a delegate cannot resubmit their information.
The code I use is:
It works, so I thought that it would be useful to have a method in my BasePage
class that I could call to Disable the cache, and reduce the call to do this in the page to one line.
The problem is, I think this is partly to do with the fact BasePage
is a referenced DLL, if I use the method call from my BasePage
dll the cache is not disabled.
Does anyone know if there is a way I can use a call this method from my BasePage
dll to disable the cache on a page, or do I have to keep it local to the website?
UPDATE 07/07
Have found something interesting.
Several sites suggest using a session variable to determine if someone is returning to the page. if they are you then fire off to a halt page.
You need the noCache
so that the page refires the Page_Load
event
But I have also found: I have a page that contains the above mentioned code, but I have a custom validation that has to hit the server to validate and returns a validation error. On correcting, so that the value is valid, then submitting again. Pressing back says the page has expired.
So if I change all the validation so that EnableClientScript
is false any error will cause the webserver to time out on a back button event once it has been successfully submitted.
This doesnt fix it completely, but it will stop people pressing back in a specific case of them entering an invalid value.
Cheers
Luke
caching - NoCaching 我的 CakePHP 页面的一小部分
我想在我网站的主页上使用 CakePHP 的基本缓存功能。但是,页面上有一个元素应该根据访问者的位置显示不同的数据,具体取决于访问者的 IP 地址。
您不能将 <cake:nocache> 包裹在控制器中设置的变量周围,这是我之前确定位置并获取数据的地方。因此,我的问题是:我在哪里可以优化设置(会话?)变量以在控制器之前包含访问者位置信息?如何使用此信息为视图的 nocached 部分填充数据数组,同时完全回避不再调用的控制器操作?
任何建议都非常感谢!
php - PHP - 将会话缓存限制器设置为 nocache 还是使用 jQuery ajax 缓存更好:false?
将会话缓存限制器设置为 nocache 还是使用 jQuery ajax cache:false 更好?
我将 PHP 与 jQuery 一起使用。我想默认session.cache_limiter
为nocache
所有使用会话的 php 页面。这样我就不必session_cache_limiter
为每个页面请求进行设置。
我不想在cache:false
从 jQuery 进行 ajax 调用时设置,因为它会为请求添加额外的时间戳 $_GET。我将 $_GET 数组的所有值传递给 MySQL。所以我必须array_pop($_GET)
在发送到数据库之前。谢谢...
browser - 如何始终强制清除用户的浏览器?
我们正在开发一个网站。我们的客户希望每天查看网站,但他们遇到了问题。每当我们在网站上进行更改时,他们都必须清除浏览器缓存。
所以我在我的服务器配置中添加了以下标头
据我所知,firefox 正在接收此标头,我很确定它正在遵守它。
我的问题是,这个“缓存控制:无缓存”是否得到保证,它是否适用于所有浏览器(包括 IE)?
jsf - 如何让后退按钮与未设置缓存的 JSF 应用程序一起使用?
这是我继承的问题。我们有一个 JSF/RichFaces/Seam 应用程序,出于安全原因,它没有设置缓存。当用户点击后退按钮,导致重新发布表单时,问题就出现了。有时(并且不一致)在点击后退按钮后重新发布表单会将支持 bean 属性设置为 null。当缓存设置为私有时,不会发生这种情况。不幸的是,这不是一个选择。
我一直在寻找解决方法,但我不确定是否有。
有谁知道用于此的标准模式?
caching - Google Chrome 缓存漏洞:尽管 NO-CACHE,Chrome 仍无法获取页面的最新版本
我想知道如何指示 Chrome 不要使用页面的缓存版本。我无法让 Google Chrome [15.0.874.106 m] 加载最新版本。页面上有错字,我已经更正了。其他浏览器获取更正的页面。铬,不是。下面是我在标题部分的内容;我应该添加什么或改变什么?此外,浏览器未设置“幕后”以使用任何类型的 DNS 预取。为了清楚起见,我不想手动清除缓存,而是想知道如何以声明的方式操作 Chrome 的页面缓存策略。谢谢
PS我以前遇到过这个问题(见这个问题)但是这次情况有些不同,所以我不知道发生了什么。这个页面也被显示在一个框架中,但它从一开始就有一个无缓存策略。
apache - apache无缓存,过期
我试图在我的网站上强制对 csv 文件进行无缓存。
我通过 apache 的文档将这些行添加到 httpd.conf:
但是当我第一次尝试获取页面时,我在 csv 文件中得到了这个:
你知道我做错了什么吗?!
谢谢!!
加比。
caching - 避免 301 重定向缓存
这是Using 301/303/307 redirects for dynamic short urls的后续问题,我尝试在目标 url 频繁更改时确定实现短 url 重定向的最佳方法。
虽然看起来 301 和 307 重定向都以相同的方式执行,但我担心的问题是 301 重定向缓存(如此处所述) - 是避免这种情况的最佳方法,而是使用 307 重定向(我假设 307 重定向永远不会缓存?),还是显式发送无缓存标头(“缓存控制:无缓存,必须重新验证”)?
iis - 在 IIS 中托管 GWT Webapp
我目前正在尝试通过 Web.config 配置 ASP.net Web 应用程序,以在特定文件夹中托管 GWT WebApp。我已经设法在 system.Webserver/staticContent 部分中为 .manifest 文件扩展名配置 mimeMap,但是,我坚持使用 clientCache。我想添加一个缓存规则,以便带有“.nocache”的文件。提供以下标头:
任何人都知道如何在 IIS 7+ 中执行此操作?