Every time I edit the site files on the server through Filezilla or through the hosting’s integrated file manager, I have to clean the browser’s cache and hope that the site has accepted the changes and loaded in a modified form. Are there any solutions to this problem?
- Yes, on the site, change the link to the file after changing the file - andreymal
- This is not a problem, but work optimization, if you can save something, why download a million times? - NTP
- @NTP if not “download a million times”, then you would not be able to read this comment now. According to your logic - why download, if comments on this issue are already in the browser cache? : D - andreymal
1 answer
Look, for example, addresses on css or js files, for example, in the header `s on this site.
Is there an extension after the extension, something like this? V = 0dd80f442adc
For example, you changed your css file and you want the cache on all client computers to be updated for this file. Modify add to the address, for example? V1. Change the address again to? V2, etc.
The name of the file itself is not necessary to change, just the address on the HTML page.
For example, you have a connected css file: <link href="/css/main.css" rel="stylesheet"> you edited it. To update its cache, its connection should look like <link href="/css/main.css?v=1" rel="stylesheet"> when you update the file again, do so <link href="/css/main.css?v=2" rel="stylesheet"> and so on.
The same with images on the site <img src="image.png?v=123">
The same with js <script src="/Js/script.js?v=28caaf93b58a"></script>
In itself, adding a string to a file address of this type ?v=123 does nothing. Just the Browser sees that the file for such an adress is not yet in the cache and pumps it out.
- Can you clarify exactly where to add it? Is it possible to attach a screen? I'm just a newbie, I don't really understand this) - Incognitus
- Posted by in reply - Dmitry Matvienko