Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

chrome not caching js & css but caches images

Recently I started noticing my JS and CSS files are not getting cached in chrome and always reloaded from server.

But images and fonts are getting loaded from cache.

Below is the server response for javascript file. Did something change in chrome behavior? this is not happening in FF or IE!

Please help!

HTTP/1.1 200 OK
Accept-Ranges: bytes
ETag: "282766-1400285984000"
Date: Wed, 18 Nov 2015 18:27:05 GMT
Cache-Control: public, max-age=31536000
Last-Modified: Sat, 17 May 2014 00:19:44 GMT
Content-Type: application/javascript
Vary: Accept-Encoding
Content-Encoding: gzip
Connection: keep-alive
Transfer-Encoding: chunked
like image 338
user3658423 Avatar asked Nov 18 '15 18:11

user3658423


People also ask

Does Chrome cache JS files?

It takes advantage of the existing HTTP resource cache, which manages caching and expiring data received from the web. When a JS file is first requested (i.e. a cold run), Chrome downloads it and gives it to V8 to compile. It also stores the file in the browser's on-disk cache.

Are .JS files cached in browser?

JavaScript and CSS files are usually cached in the browser after the first access. The browser cache is used to store web application assets like images, CSS, and JS code on your computer's hard drive.

How do I force the browser to reload cached JS?

It works, all the time, for everyone. But, if you're not using it, and you just need to reload that one CSS or JS file occasionally in your own browser... just open it in its own tab and hit SHIFT-reload (or CTRL-F5)!

How do I refresh JavaScript in Chrome?

Hold down Ctrl and click the Reload button. Or, Hold down Ctrl and press F5. just open the Chrome Dev Tools by pressing F12. Once the chrome dev tools are open, just right click on the refresh button and a menu will drop down.


1 Answers

On a mac using this version of chrome: Version 54.0.2840.87 (64-bit) I have found that javascript files are not cached if the site you are accessing is untrusted (ie: https to a site/localhost using a self signed certificate)

like image 92
Yong Lee Avatar answered Sep 30 '22 07:09

Yong Lee