[英]What names should js files have, to which urls with a strange ending lead: ".../filename.js?crc=6»?
In html pages, I saw some strange are the paths to js documents:在 html 页面中,我看到一些奇怪的是 js 文档的路径:
— attached the code at the end of the question — —在问题末尾附上代码—
I noticed the "?crc=6" after the usual ".js".我注意到通常的“.js”之后的“?crc=6”。 As I understand it, "?crc=6" is used to indicate the version of this file in case any of its previous editions will be in the browser cache.
据我了解,“?crc=6”用于指示此文件的版本,以防它的任何以前的版本将在浏览器缓存中。 There were presumably five of them here (each time the file was changed in the URL this number also changed so that the browser considered the file different and did not take the old one from the cache).
这里大概有五个(每次在 URL 中更改文件时,此数字也会更改,以便浏览器认为文件不同,并且不会从缓存中获取旧文件)。 What names should the js files to which these links lead have?
这些链接指向的js文件应该有什么名称? Should they be spelled out together with "?crc=6" or use a simple notation with ".js"?
它们应该与“?crc = 6”一起拼写还是使用“.js”的简单符号?
<script src="/js/jquery.fancybox.min.js?crc=6" type="text/javascript"></script>
<script src="/js/jquery.cookie.js?crc=6" type="text/javascript"></script>
<script src="/js/popper.min.js?crc=6" type="text/javascript"></script>
<script src="/js/bootstrap.bundle.min.js?crc=6" type="text/javascript"></script>
<script src="/js/bootstrap.min.js?crc=6" type="text/javascript"></script>
<script src="/js/jquery.formstyler.js?6" type="text/javascript"></script>
<script src="/js/wavesurfer.min.js?6" type="text/javascript"></script>
<script src="/slick/slick.min.js?6" type="text/javascript"></script>
<script src="/js/common.js?99" type="text/javascript"></script>
I noticed the "?crc=6" after the usual ".js". As I understand it, "?crc=6" is used to indicate the version of this file in case any of its previous editions will be in the browser cache. There were presumably five of them here (each time the file was changed in the URL this number also changed so that the browser considered the file different and did not take the old one from the cache).
What names should the js files to which these links lead have? Should they be spelled out together with "?crc=6" or use a simple notation with ".js"?
The filename on the webserver should end in only .js
.网络服务器上的文件名应仅以
.js
结尾。 Question marks are invalid in filenames anyway on some operating systems.在某些操作系统上,问号在文件名中无论如何都是无效的。
The only purpose of the query parameter is to force the client to make a new request to the webserver if that version of the script is not in the browser cache yet - on a static site, a request to /js/jquery.fancybox.min.js?crc=6
will result in the site returning the file located at /js/jquery.fancybox.min.js
.查询参数的唯一目的是强制客户端向网络服务器发出新请求,如果该版本的脚本尚未在浏览器缓存中 - 在 static 站点上,对
/js/jquery.fancybox.min.js?crc=6
的请求/js/jquery.fancybox.min.js?crc=6
将导致站点返回位于/js/jquery.fancybox.min.js
的文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.