简体   繁体   English

包括javascript文件和w3c验证

[英]including javascript file and w3c validation

I bought a template and in the main page, it included the javascript file as follow: 我购买了一个模板,并在主页上包含了如下的javascript文件:

<script
    src="thefile.js?v=v1.9.6&sv=v0.0.1"></script>

As you can see there are two argument at the end of the file one is v which I assume is the version and sv which I don't know what is it. 如您所见,文件末尾有两个参数,一个是v,我认为是版本和sv,我不知道它是什么。 When I check the file in one of the w3c validator, It shows error and says that the " & did not start a character reference". 当我在w3c验证程序之一中检查文件时,它显示错误并说“&未启动字符引用”。 Now I have two questions: First what is the sv stands for and second should I remove the & in the script to eliminate the error? 现在,我有两个问题:首先,sv代表什么;其次,应该删除脚本中的&以消除错误吗?

The param ?v=v1.9.6&sv=v0.0.1 indicates a query string, and the browser will therefore think it is a new path from, say, ?v=v1.9.6&sv=v0.0.1. 参数?v = v1.9.6&sv = v0.0.1表示查询字符串,因此浏览器将认为这是从?v = v1.9.6&sv = v0.0.1开始的新路径。 Thus causing it to load from file, not from cache. 因此导致它从文件而不是从缓存加载。 As you want. 如你所愿。

And, the browser will assume that the source will stay the same next time you call ?v=v1.9.6&sv=v0.0.1 and should cache it with that string. 并且,浏览器将假定您下次调用?v = v1.9.6&sv = v0.0.1时源将保持不变,并应使用该字符串对其进行缓存。 So it will remain cached, however your server is set up, until you move to ?v=v1.9.7&sv=v0.0.2 or so on. 因此它将保留在缓存中,但是服务器已设置完毕,直到您移至?v = v1.9.7&sv = v0.0.2等。

& is unrecognized char use its html code "&amp" to avoid errors as mentioned in comment &是无法识别的字符,请使用其html代码“&amp”来避免注释中提到的错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM