browser-cache

Disable browser caching for css and js file during development

一笑奈何 提交于 2020-01-05 05:24:25
问题 How can we disable browser cache during application development process so that whenever we make any changes to the css or js files in localhost(or any development environment) we don't have to do a hard refresh on the browser to see the changes 回答1: Try this for all css and js. This example you should add time in all css and js <link rel="stylesheet" type="text/css" href="style.css?<?php echo date('l jS \of F Y h:i:s A'); ?>" /> or <link href="/css/styles.css?ver=<?php echo time();?>" rel=

Break image caching in browser

不羁岁月 提交于 2020-01-05 04:03:38
问题 No code, because this is mostly conceptual: So I've got a folder of images named thusly: 1.jpg 2.jpg 3.jpg 4.jpg These images populate a gallery, and as you might assume, the ordering in the gallery is dictated by their names. So, in my php thingamabob, I allow the client to reorder the images. So, say our images depict these things: 1.jpg - "dog" 2.jpg - "cat" 3.jpg - "chicken" 4.jpg - "postmodernism" My client decides to show "postmodernism" first, so my php thingamabob renames 4.jpg to 1

What happens when a browser's cache is full?

与世无争的帅哥 提交于 2020-01-05 04:02:29
问题 What happens when a web browser's cache is full? Does it Delete the oldest items in the cache to make room? Stop caching entirely? Is this behavior documented for the major browsers like IE, Firefox, Chrome, and Safari? 回答1: Google claims every browser use LRU to decide what to dump. Here: code.google.com/speed/page-speed/docs/caching.html 来源: https://stackoverflow.com/questions/8362292/what-happens-when-a-browsers-cache-is-full

PHP header 301 redirect not working due to browser cache

倖福魔咒の 提交于 2020-01-05 04:01:37
问题 My code is the following: <?php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://newsite.com/"); ?> The issue I am having is several users have already reported the page not redirecting them and instead showing them the content on the old page, but later in the day it showed the correct redirect. I know it has to be related to the caching but which is the most efficient and standardized way to bypass the cache for the above redirect? Would I use php or javascript? Thank you.

Referencing javascript files on my local machine

丶灬走出姿态 提交于 2020-01-05 04:01:05
问题 I know that its possible to reference third party JavaScript files on the web like so: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> Is it possible to reference javaScript file on my local machine by doing something like this? <script src="file:///C:/folder/custom_javascript.js" type="text/javascript"></script> I suspect this may be a no-no, since it could be a way for websites to find out what files are on a client's computer..

Chrome slow to load resources `(from disk cache)`

假如想象 提交于 2020-01-03 08:37:13
问题 My site http://www.front-end.io configures the HTTP requests to load resources from cache with first priority. So my header will be like: cache-control:max-age=315360000 ETag:W/"11913b-ks0rwRQM+ijHcl1HDuse3g" Chrome indeed does not initiate any request (even 304) to the server, it loads from the cache directly: It takes my Windows10 Chrome >400ms to load the js file from local disk. My Ubuntu Chromium also takes >100ms. But FireFox takes around 10ms only! I found this question as well, Google

Cache images on php script

早过忘川 提交于 2020-01-03 05:12:10
问题 I am using this great randomizer code found here: http://alistapart.com/article/randomizer , but the images are not saved on the browser's cache which means they refresh whenever the site reloads. Is it possible to keep the images cached on the following code? The reason I am using this script is that php parse on css doesn't work on my server for some reason. <?php $folder = '.'; $extList = array(); $extList['gif'] = 'image/gif'; $extList['jpg'] = 'image/jpeg'; $extList['jpeg'] = 'image/jpeg

Android browser ignores cache manifest on mobile device (Galaxy S3)

老子叫甜甜 提交于 2020-01-03 04:35:14
问题 I have a web application in which I am using a cache manifest. In short, when I modify the cache manifest, all browsers EXCEPT Android (Galaxy S3) will fetch the new files and update the cache. It works just as expected with Iphone and desktop Chrome/Safari browsers. Even if I download Chrome onto the S3, it works fine. It almost seems that the device is even caching the manifest file so that it appears to not have changed. I'm not sure. Does anyone have any ideas as to why this may be

ReactJS: How to prevent browser from caching static files?

走远了吗. 提交于 2020-01-02 05:24:11
问题 I'm working on my project using ReactJS and I use create-react-app to create my app. After building project, I use my server to serve the build folder. And when I update my app, the browser of user still uses the old version of my app because it caches the static files (js, css). So is there any way to prevent browser from caching static files ? Thank you ! 回答1: TLDR: You will want to send caching instructions via HTTP headers. The Cache-Control header has several directives to control cache

What do I put in my HTML to ensure users get latest version of my page, not old version?

左心房为你撑大大i 提交于 2020-01-01 16:37:06
问题 I have a mostly static HTML website served from CDN (plus a bit of AJAX to the server), and do want user's browsers to cache everything, until I update any files and then I want the user's browsers to get the new version. How do I do achieve this please, for all types of static files on my site (HTML, JS, CSS, images etc.)? (settings in HTML or elsewhere). Obviously I can tell the CDN to expire it's cache, so it's the client side I'm thinking of. Thanks. 回答1: One way to achieve this is to