Why the browser does not update the source?

Occur frequently the situation, help to understand.
For example, make a piece of code which changes the link to the image depending on the selected option in the select boxes. After I finished the save, update the page and check it out. Images are not displayed. Find a reason - a typo in the domain name. Fixing the code. Refreshes the page. Still doesn't work. Find the cause. In the browser look at the source of the script, still neispravno domain name. Update empty cache and hard helllord. Not working. Leave this for an hour. Doing anything else. Going back to this job, I go to the page - everything works.
What's happening, how to avoid it?
June 26th 19 at 13:56
2 answers
June 26th 19 at 13:58
Solution
1. Vagrant use?

Turn off sendfile in Nginx and Apache

if nginx in the file /etc/nginx/nginx.conf and change the option
sendfile off

if Apache depending on the operating system, find the httpd.conf or apache.conf and change the option EnableSendfile off

2. The Expiration headers are set?
It's actually a good practice, but in the development stopping
Try to make so: in production get file VERSION.txt and write down there the version number (e.g. 1.0) at the time when the update roll out. Such a file is not here.
When connecting the CSS to the page, verify the presence of such a file. If the file is not, then put the current timestamp.

Example in PHP
<?php
$versionPath = 'path/to/VERSION.txt';
$version = is_file($versionPath) ? file_get_contents($versionPath) : time();
?>
<link rel="stylesheet" href="/path/to/style.css?v=<?php echo $version ?>">


In production you have a link to CSS with a fixed version of the form
<link rel="stylesheet" href="/path/to/style.css?v=1.0">


And your car will always be a unique URL that will be fresh, even if the Expiration header set.
<link rel="stylesheet" href="/path/to/style.css?v=1494560580">


Same for JS and image files. Label version solves a lot of problems as you and users of your website after rolling out the updates to the server.
June 26th 19 at 14:00
Cache
[edit | edit wiki text]the Material from Wikipedia, the free encyclopedia
This term there are other uses, see Cache (disambiguation).
Cache[1][2][3][4] or the cache[5][6][7] (eng. cache, from the French. cacher "to hide"; pronounced [kæʃ] — "cache") — intermediate buffer with fast access, containing information that may be requested with the greatest probability. Access to the data in the cache is faster than fetching the source data from a slower memory or a remote source, but its volume is significantly reduced compared to the original data store.


In browsers there is a hotkey for restart with ignore cache - ctrl+F5 or ctrl+R.
The servers are the headlines: html5.by/blog/cache
In browsers there is a hotkey for restart with ignore cache - ctrl+F5 or ctrl+R.

I learned that you can refresh with f5 key, which I never did), Neither ctrl + R nor empty cache and hard reload not helping me. - Shaylee commented on June 26th 19 at 14:03

Find more questions by tags JavaScript