Questions tagged [browser-cache]

Browser caches are an instance of the optimization mechanism known as a cache.

Browser caches are an instance of the optimization mechanism known as a cache.

The browser cache is nothing more than a place on your hard disk where the browser keeps things that it downloaded in case they're needed again.

For example, the first time you visit a web page, the browser will download some files like the logo image or icon images, so that it can be shown.

Since it's faster to get something to display from your hard disk than it is to get it from the internet, every time thereafter when you visit the same web page or any page on that domain, the browser will be searching for the required images and other files on its cache folder. Only if not found it goes to the internet to download them.

2673 questions
87
votes
10 answers

How do you cache an image in Javascript

My friends and I are working on a website where we would like to cache certain images in order to display them faster in the future. I have two main questions: How do you cache an image? How do you use an image once it has been cached? (and just…
Logan Besecker
  • 2,413
  • 3
  • 20
  • 21
81
votes
3 answers

How to set cache false for getJSON in jQuery?

I am using getJSON to fetch the results from server side but facing browser cache problems. I want the cache to be false. I tried using this just before my getJSON call. $.ajaxSetup({ cache: false }) But I am not…
Abhinav
  • 951
  • 2
  • 10
  • 17
64
votes
4 answers

Chrome - Disable cache for localhost only?

I'm using localhost for development; and I'm directly including jquery from CDN. It seems that pressing the "Ctrl + R" would force the pace to reload, including re-downloading the jquery from CDN. I want to ask if it's possible that.. when I…
songyy
  • 3,881
  • 4
  • 36
  • 58
64
votes
6 answers

What's default value of cache-control?

My problem is: sometimes browser over-cached some resources even if i've already modified them. But After F5, everything is fine. I studied this case whole afternoon. Now i completely understood the point of "Last-Modified" or "Cache-Control". And i…
rhapsodyn
  • 2,952
  • 4
  • 25
  • 36
57
votes
3 answers

Why use a service worker for caching when browser cache handles the caching?

I read that using a service worker for offline caching is similar to browser caching. If so, then why would you prefer a service worker for this caching? Browser caching will check if the file is modified or not and then serve from the cache, and…
bvakiti
  • 2,263
  • 1
  • 13
  • 24
56
votes
4 answers

Leverage browser caching, how on apache or .htaccess?

What to do here? I have a huge list of files that Google Speed Page said to "Leverage Browser Caching".. but I don't know how? Do I mess or change the Apache config file (below) or do I put something in my .htaccess page?
eberswine
  • 1,172
  • 3
  • 17
  • 36
56
votes
14 answers

Stylesheet not updating

I am creating a website, but when I made changes to the stylesheet on my site, and I refreshed the site, none of the changes were there. I tried to use the view source tool to check the stylesheet.css and it isn’t updated either. But when I go to…
Mihad Aiko
  • 699
  • 1
  • 9
  • 12
55
votes
14 answers

Is there a way to force browsers to refresh/download images?

I have a problem where users are reporting that their images aren't being uploaded and the old ones are still there. On closer inspection the new images are there, they just have the same name as the old one. What I do on the upload is that I rename…
uriDium
  • 12,309
  • 19
  • 70
  • 131
54
votes
5 answers

Firefox invalidate dns cache

I was too quick about visiting a site I set up on a customer server, and Firefox now remembers, that the default site for (example) testsite.mycompanyname.com (non existing subdomain, same as *.mycompanyname.com) is www.mycompanyname.dk - or…
Steen
  • 2,503
  • 2
  • 17
  • 31
49
votes
2 answers

Chrome refresh right-click reload options not available

I'm trying to do a hard reload and empty cache in Chrome because a previously loaded site keeps coming up on the localhost port I'm using. Problem is the the right-click options seems to have stopped working, ie. nothing happens when I right-click…
mikeym
  • 4,006
  • 6
  • 26
  • 42
48
votes
7 answers

How do I 'leverage browser caching' for Google fonts?

I tested my site via Pingdom and got this: I searched but couldn't find a solution to this. Does anyone know how I can get this 14 to 100?
J82
  • 7,605
  • 21
  • 48
  • 79
47
votes
4 answers

How long are files usually kept in a browser's cache

How long are files usually kept in a browser's cache? I'm wondering about the general population - how long would I need to wait to be reasonable certain that most people's caches will refetch the file?
B T
  • 46,771
  • 31
  • 164
  • 191
46
votes
3 answers

How to prevent browser from caching form fields?

I have a textbox in a form field that gets populated by the user. However currently (in Firefox 10) the user can navigate away from the page, then come back, and the input will be populated with its previous value. I think this creates for a…
Igor
  • 30,885
  • 14
  • 70
  • 107
45
votes
6 answers

VueJS/browser caching production builds

I have a VueJS app. Whenever I run npm run build it creates a new set of dist/* files, however, when I load them on the server (after deleting the old build), and open the page in browser, it loads the old build (from cache i assume). When I refresh…
ierdna
  • 4,056
  • 6
  • 39
  • 66
43
votes
2 answers

Make IE cache the resources but always revalidate

The cache control header "no-cache, must-revalidate, private" allows browsers to cache the resource but forces a revalidate with conditional requests. This works as expected in FF, Safari, and Chrome. However, IE7+8 does not send a conditional…
alienhard
  • 13,366
  • 9
  • 34
  • 28