Search code examples
javascripthtmlw3c

including javascript file and w3c validation


I bought a template and in the main page, it included the javascript file as follow:

<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. When I check the file in one of the w3c validator, It shows error and says that the " & did not start a character reference". 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?


Solution

  • 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. 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. 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.

    & is unrecognized char use its html code "&amp" to avoid errors as mentioned in comment