简体   繁体   English

js 文件应该有什么名称,带有奇怪结尾的 url 引导:“.../filename.js?crc=6»?

[英]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.

相关问题 “node filename.js”在 vs 代码中不起作用 - “node filename.js” is not working in vs code ver = 3.1.2是什么意思?在ajax.js或filename.js末尾的ver = 3.1.2是什么意思? - What does ver=3.1.2 at the end of ajax.js or filename.js?ver=3.1.2 mean? 如何在Electron中触发节点filename.js文件? - How to trigger node filename.js file in Electron? jscs 错误:validateLineBreaks:filename.js 处的换行符无效 - jscs error : validateLineBreaks: Invalid line break at filename.js 在Docker容器中运行命令&#39;node filename.js&#39; - Run command 'node filename.js' inside a Docker container 运行节点fileName.js命令后如何返回终端执行? - How to return to terminal execution after running node fileName.js command? 当我输入终端命令“$ node fileName.js”时,concole 会抛出“SyntaxError: Unexpected token &#39;&lt;&#39;”错误 - When I enter the terminal command "$ node fileName.js" the concole throws out a "SyntaxError: Unexpected token '<'" error JS 计数器递减不应该发生 - JS Counter decrementing which should not have happened 在具有常见js文件的不同cshtml文件中定义javascript变量的正确方法是什么? - What is the proper way for defining javascript variables in different cshtml files which have a common js file? 我有一个 js 脚本,它应该禁用一个按钮,但它不起作用 - I have a js script which should disable a button but it's not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM