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.

2884 questions
134
votes
6 answers

Make page to tell browser not to cache/preserve input values

Most browsers cache form input values. So when the user refreshes a page, the inputs have the same values. Here's my problem. When a user clicks Save, the server validates POSTed data (e.g. checked products), and if not valid, sends it back to the…
queen3
  • 15,333
  • 8
  • 64
  • 119
114
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,733
  • 4
  • 23
  • 21
87
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
  • 3,272
  • 5
  • 29
  • 36
82
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
  • 961
  • 2
  • 11
  • 17
81
votes
4 answers

How does the chrome browser determine memory cache and disk cache?

I knew that Google Chrome supports from memory cache and from disk cache when I request resources. However, I didn't see from memory cache before. How does chrome determine which resources should be cached in memory?
gentlejo
  • 2,690
  • 4
  • 26
  • 31
77
votes
7 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 page to reload, including re-downloading the jquery from CDN. I want to ask if it's possible that.. when I…
songyy
  • 4,323
  • 6
  • 41
  • 63
77
votes
16 answers

Stylesheet not updating when I refresh my site

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
  • 909
  • 2
  • 11
  • 12
75
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
  • 3,243
  • 4
  • 17
  • 26
71
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
  • 13,110
  • 20
  • 78
  • 138
70
votes
4 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. The problem is the right-click options seem to have stopped working, ie. nothing happens when I right-click on…
mikeym
  • 5,705
  • 8
  • 42
  • 62
57
votes
7 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
  • 5,753
  • 7
  • 50
  • 84
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,224
  • 3
  • 20
  • 39
56
votes
14 answers

How do I cache bust imported modules in es6?

ES6 modules allows us to create a single point of entry like so: // main.js import foo from 'foo'; foo() foo.js will be stored in the browser cache. This is desirable until I push a new…
spinners
  • 2,449
  • 3
  • 23
  • 34
55
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
  • 57,525
  • 34
  • 189
  • 207
55
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,749
  • 2
  • 20
  • 36