In the actual project development process, the page is uploaded to the server. In order to reduce the pressure on the server and let users load less, the browser will cache images, CSS, and JS locally for use the next time the website is visited. Doing so not only reduces the pressure on the server, but also reduces the number of downloads for users, providing a better user experience. However, when upgrading the version or making some adjustments to CSS, JS, etc., the cache causes users to be unable to display the updated style, which is a headache. Unless the user manually upgrades the cache, almost all users will not manually clear the cache in order to access the website normally, because users don’t know whether it is a cache problem. In the final analysis, users just think that there is a problem with your page and it cannot be accessed normally. In order to use the cache normally and avoid such problems, we can use our brains to think about how to solve this problem? If the changed style cannot be accessed normally, what about changing the style file name? The answer is yes, and it will not be verified here. However, it is obviously too troublesome to manually change the file name every time. Is it possible not to change the file name? The answer is yes. We may add a version number after the imported file name, which is different from the previous version (usually the update date). The code is as follows: Copy code The code is as follows:<link rel="stylesheet" type="text/css" href="reset.css?v=20140829"> <script type="text/javascript" src="core.js?v=20140829"></script> You can see that my CSS file name and JS file name are followed by "v=20140829". This way, I can cache the files without changing the file name and update them in real time. "v=20140829" is just a common writing habit and can be changed to other ones. Finally, there are pictures. Generally, pictures with img tags will not have duplicate names because the file names are generated in the background. If it is a picture with a fixed file name, the method is the same as above. As for the background image, since the style name is changed, the image resolution path is naturally updated synchronously, so the background image is also updated. |
<<: Summary of MySQL's commonly used database and table sharding solutions
>>: Detailed explanation of basic concepts of HTML
Download the Windows version of Nginx from the Ng...
Exposing network ports In fact, there are two par...
Table of contents 01 Background 02 Introduction 0...
HTML is a hybrid language used for publishing on ...
Dynamically adding form items iview's dynamic...
For commercial databases, database upgrade is a h...
Suddenly, I needed to build a private service for...
An optimization solution when a single MYSQL serv...
question The tomcat container was successfully ad...
The default operating mode of MySQL is autocommit...
A simple MySQL full backup script that backs up t...
Recently, the Vue project needs to refresh the da...
Some fault code tables use the following design p...
When installing mha4mysql, the steps are roughly:...
The GtkTreeView component is an advanced componen...