no-cache

How long does Google Chrome cache a resource if expires and/or no-cache headers are not set?

谁说胖子不能爱 提交于 2020-01-10 09:06:07
问题 We have been having a problem with Chrome caching a resource on our Glassfish server. The expires and no-cache headers are not being sent and the resource (an approximately 4 MB SWF file) is being cached by Chrome -- despite the presence of the Last-Modified header. Sometimes Chrome will get a 304 code, and other times it simply does a 200 (from cache). I understand the 304 -- Chrome is likely checking the most recent Last-Modified date with the cached version to decide. But other times it

如何设置max-age或expires来缓存您的站点文件

廉价感情. 提交于 2020-01-07 07:42:58
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 方法: <meta http-equiv="Cache-Control" content="max-age=7200" /> <meta http-equiv="Expires" content="Mon, 20 Jul 2009 23:00:00 GMT" /> 详情: Cache-control用于控制HTTP缓存(在HTTP/1.0中可能部分没实现,仅仅实现了Pragma: no-cache) 数据包中的格式: Cache-Control: cache-directive cache-directive可以为以下: request时用到: | "no-cache" | "no-store" | "max-age" "=" delta-seconds | "max-stale" [ "=" delta-seconds ] | "min-fresh" "=" delta-seconds | "no-transform" | "only-if-cached" | "cache-extension" response时用到: | "public" | "private" [ "=" <"> field-name <"> ] | "no-cache" [ "=" <"> field-name <"> ] | "no

How to automatically refresh external data loaded into Javascript variables in HTML?

*爱你&永不变心* 提交于 2019-12-24 19:18:44
问题 I have digital information written as Javascript variables by PHP into a .txt-File. This information gets changed by a user at a different interval. var ISTUHSXDATE8 = '21.1.2018'; var ISTUHSXTIME8 = '20:11'; var ISTUHSXROT8 = 0; var ISTUHSXGELB8 = 0; var ISTUHSXGRUEN8 = 1; var ISTUHSXAUSLASTUNG8 = '0%'; To show actual information in the HTML body, it´s necessary to make the HTML document load the latest version of .txt from server. [At the moment handmade by push the button and in webprojekt

Laravel response Cache-Control headers always containing 'no-cache'

我是研究僧i 提交于 2019-12-21 07:15:47
问题 For some reason Laravel seems to be manipulating the response headers 'Cache-Control' on the very last moment. I want to make browser caching possible. class TestController extends Controller { public function getTest() { $response = new \Illuminate\Http\Response('test', 200, array( 'Cache-Control' => 'max-age='.(config('imagecache.lifetime')*60).', public', 'Content-Length' => strlen('test'), )); $response->setLastModified(new \DateTime('now')); $response->setExpires(\Carbon\Carbon::now()-

Safari browser ignoring my no-cache

放肆的年华 提交于 2019-12-18 04:18:21
问题 I'm unable to force a page to always expire in Safari. Chrome, IE and Firefox are good citizens but Safari is cruising along just fine with ignoring the following ASP.NET code: // Expire immediately Response.Expires = 0; Response.Cache.SetNoStore(); Response.AppendHeader("Pragma", "no-cache"); Any recommendations? 回答1: Believe it or not, the way to make Safari always reload the page was simply to add this to the body tag: onunload="" I found a mention of this here: Is there a cross-browser

How to prevent some background-images caching

青春壹個敷衍的年華 提交于 2019-12-13 16:31:50
问题 adding some random number it works, but only for img <img src="example.jpg?377489229" /> Is there any way to prevent caching prp. background-image ? <div style="background-image: url(example.jpg )"></div>" 回答1: The same technique will work there. <div style="background-image: url(example.jpg?377489229)"></div> Assuming your server doesn't act differently with the presence of that GET param. This will only break the cache once though, if you want it to always hit the server, you will need to

how to disable web page cache throughout the servlets

送分小仙女□ 提交于 2019-12-13 05:17:12
问题 To no-cache web page, in the java controller servlet, I did somthing like this in a method: public ModelAndView home(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView mav = new ModelAndView(ViewConstants.MV_MAIN_HOME); mav.addObject("testing", "Test this string"); mav.addObject(request); response.setHeader("Cache-Control", "no-cache, no-store"); response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", 0); return mav; } But this only

Disable browser caching HTML5

扶醉桌前 提交于 2019-12-11 18:23:52
问题 I would like to know how to disable the browser cache, using HTML5. I found this useful post (How to control web page caching, across all browsers?), but it contains the info only for HTML4 or other languages. In my web application I use Java ( Spring Boot ) and Thymeleaf to produce HTML5. I would like to understand what are the equivalent tags for HTML5, of the following HTML tags: <meta http-equiv="Cache-Control" content="no-cache"/> <meta http-equiv="Pragma" content="no-cache"/> <meta http

how to verify “Cache-Control”, “no-cache, no-store, must-revalidate”

◇◆丶佛笑我妖孽 提交于 2019-12-10 10:51:30
问题 I am learning about cache and how to manage it. I can see that static content like images, css files, js files gets stored in temporary folder when I open my website pages. But now when I added these attributes in response header, I cannot see any changes in cache behaviour. All content is getting stored like before. And even when I am making some changes in js files, I cannot see new js files being fetched. Browser uses the same old js files with outdated content. So am I doing something

no-cache script without using Jquery

痞子三分冷 提交于 2019-12-08 03:30:45
问题 Hello I am trying to create a script which inserts into any webpage a meta tag to force no-cache . Currently this is my code and I dont want to use Jquery (as shown in Script to force IE8 cache behaviour). var MAXlen = document.getElementsByTagName('head')[0].childNodes.length; //Get the length of childnodes of head. while(MAXlen--) { document.getElementsByTagName('head')[0].childNodes[MAXlen+1] = document.getElementsByTagName('head')[0].childNodes[MAXlen]; //store every node one place after.