Google Chrome does not store JavaScript and CSS files in its cache, but it does cache images

Recently I've noticed a strange issue with my website - the JS and CSS files are no longer being cached in Chrome, always reloading from the server.

Oddly enough, images and fonts are still loading from cache without any problems.

Take a look at the server response for the JavaScript file. Has something changed in Chrome's behavior recently? This isn't an issue in Firefox or Internet Explorer!

If anyone has encountered this before or has a solution, 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

Answer №1

When using a Mac with Chrome Version 54.0.2840.87 (64-bit), I've noticed that JavaScript files are not cached when accessing an untrusted site or localhost with a self-signed certificate over HTTPS.

Answer №2

Your cache settings are optimized for maximum performance, including javascript files:

Cache-Control: public, max-age=31536000
  • 365 days in seconds equals 31,536,000 seconds
  • 1 month in seconds is equivalent to 2,629,743 seconds
  • 1 week in seconds translates to 604,800 seconds
  • 1 day in seconds amounts to 86,400 seconds

Chrome handles resources differently when developer tools are open, although both behaviors can be customized in the settings.

In order to provide specific configuration assistance, please specify the server you are using...

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Transferring mouse events from iframes to the parent document

Currently, I have a situation where my iframe is positioned over the entire HTML document. However, I am in need of finding a way to pass clicks and hover events from the iframe back to the main hosting document. Are there any potential solutions or alter ...

The layout causes issues with responsiveness on the Flask app page

I'm currently in the process of developing a web application and I've implemented a navbar.html file as the layout for each page using the following code: eachpage.html : {% extends 'navbar.html' %} {% block body %} <div class=" ...

The Express.js static() function seems to have trouble serving files from subdirectories that are more than one level deep

My Express.js app has a folder structure displayed on the left. Line 19 utilizes static(). The path for './client' is defined, with path.join() included as well. In the network log on the right, all assets load properly except for the components ...

Calculating the number of digits in a series of numbers, experiencing a timeout issue (What is the page count of a book? from codewars)

Solving the Digits in a Book Problem Find the number of pages in a book based on its summary. For example, if the input summary is 25, then the output should be n=17. This means that the numbers 1 to 17 have a total of 25 digits: 123456789101112131415161 ...

I am looking to pass the value of the textbox to the controller in the MVC framework

In my view, I have a textbox set up like this: < input type="text" id="Quant" value="@item.Quantity"/> My goal is to pass the value of this textbox to an action method when it is changed. Here is my action method: public ActionResult Quant(int id ...

JavaScript - Removing Content from an Element

I have a coding script that adds an image preview of uploaded images. The issue I am facing is that the previous image does not clear when the form is filled out again. The id of the div where thumbnail images are being displayed is "thumbnail". Can someo ...

Impact of shaking the browser window using JavaScript

Is there a way to create a browser screen shaking effect using javascript? I attempted to use window.moveBy(x,y) after researching online, but it didn't work as expected. Are there any libraries or code snippets available that can assist in achievin ...

Is UseEffect selectively triggering specific components?

I am attempting to ensure that each time my search field changes, the code within useEffect is executed. Strangely, only console.log('hi') seems to be running while the other code is not. I am struggling to understand why useEffect is choosing t ...

Can you point me in the direction of the Monaco editor autocomplete feature?

While developing PromQL language support for monaco-editor, I discovered that the languages definitions can be found in this repository: https://github.com/microsoft/monaco-languages However, I am struggling to locate where the autocompletion definitions ...

What are the necessary headers that must accompany a post request?

While testing the server with Postman, everything seems to be working fine as I receive a response: https://i.stack.imgur.com/yMRfj.png However, when attempting to make a POST request from the browser using the same address, it results in an error and th ...

Creating a key-shaped design with CSS: A step-by-step guide

Looking to create a unique shape within an HTML div? By utilizing custom CSS in an HTML table, I can design a layout where one column features a rounded avatar while the other displays a rectangular box. However, I am struggling to make the circle overlap ...

Obtain GPS coordinates (latitude/longitude) from a Google map by dropping a marker on the

Is there a straightforward script that can load a Google Map and, when clicked, display a marker that saves the latitude and longitude values to a variable? Does anyone know if there is an existing PHP solution for this functionality? Appreciate any help ...

Is full support for CSS 3D transforms (preserve-3d) provided by IE11?

Creating a web app utilizing css 3d transforms, my goal is to have IE11 support if feasible. I am aware that IE10 does not endorse the preserve-3d value for the transform-style css attribute, however, there seems to be conflicting information regarding I ...

Press the Spin button located in the Protractor app

<hs-details-item ng-repeat="item in amenities" style="overflow:hidden" class="ng-scope"> <hs-label class="ng-binding">Pepsi</hs-label> <hs-value-block> <hs> <hs-sp ...

How can I centrally align the text(link) vertically in relation to its background image?

After setting the background color, height, and width of a link using CSS, I managed to align the text(link) center horizontally by applying the "text-align: center" property. However, I am facing difficulty in vertically centering it with respect to its ...

Clear out the existing elements in the array and replace them with fresh values

Within my Progressive Web App, I am utilizing HTTP requests to populate flip cards with responses. The content of the requests relies on the selected values. An issue arises when I choose an item from the dropdown menu. It triggers a request and displays ...

Collaborate on React-Native components together!

As a newcomer to the world of react, react-native, and nodejs, I embarked on creating my own node module using npm init. Within this module, I developed a component for styling buttons, packaging it with npm pack and linking it in my application's pac ...

Create a JavaScript/jQuery function that causes an element to fade in when the mouse is

I am currently developing a PHP/MySQL project that involves creating a function to display a brief description when a user hovers over an image. However, I seem to be encountering an issue where the function crashes after a few uses. Below is a snippet of ...

How to dynamically add HTML content to a JSON string with the help of Javascript

I am working with a JSON object that includes various messages to be displayed on a webpage using Javascript. This JSON file is located in a separate directory and I have full control over it, being loaded asynchronously. There are specific cases where di ...

Guide to naming Vite build JS and CSS bundles in Vue

As I work on building a SPA using Vite+Vue3 and JavaScript, I have encountered an issue when running npm run build. After making changes, the resulting .css and .js files have names that appear to be generated from a hash, which is not ideal. I would like ...