Add ?v= after js or css to prevent the browser from caching_HTML/Xhtml_web page production
WBOY
Release: 2016-05-16 16:37:10
Original
1343 people have browsed it
Copy code
The code is as follows:
css and js with parameters (in the form of .css?v= and .js?v= or .css?version= and .js?version= )
There are two possibilities for using parameters:
First, the script does not exist, but is dynamically generated by the server, so it brings a Version number to indicate the difference. That is, the above code is equivalent to
Copy code
The code is as follows:
But the browser will think it is a certain version of the file!
Second, the client will cache these css or js files, so every time after upgrading the js or css file and changing the version number, the client browser will re-download the new js or css file and refresh it. The role of sexual caching. You may sometimes find that if you modify the style or js, it will not change when refreshing, that is, the client caches the css or js file, so adding parameters is still beneficial! The second situation is the most common, or both may exist at the same time.
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn