Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "?", used after JavaScript filename, means?

For example, having:

<script type="text/javascript"
        src="http://somedomain.com/js/somejs.js?14">
</script>

So what does "?14" means here?

like image 531
Milkywayfarer Avatar asked Oct 28 '10 14:10

Milkywayfarer


People also ask

What is JavaScript file name?

There is no official, universal, convention for naming JavaScript files. There are some various options: scriptName. js. script-name.

What does a JavaScript file end in?

JavaScript files have the file extension .js.

How do I change a filename in JavaScript?

To rename a file we have to create a new file and pass our new name to the File constructor. const myRenamedFile = new File([myFile], 'my-file-final-1-really. txt'); console. log(myRenamedFile); // Browser logs: File {name: "my-file-final-1-really.

What is a JavaScript file?

What is a JS file? JS (JavaScript) are files that contain JavaScript code for execution on web pages. JavaScript files are stored with the . js extension. Inside the HTML document, you can either embed the JavaScript code using the <script></script> tags or include a JS file.


2 Answers

Its a url param like any other parameter passed in a url. Sometimes JS scripts are created on the fly using server side technologies other times it is simply a version number to help with browser caching issues.

like image 82
Sruly Avatar answered Sep 20 '22 20:09

Sruly


They are there to fool browsers into thinking that it is a new file.

This is a trick to avoid browser-cached copy when you update the JS file.

like image 24
chakrit Avatar answered Sep 20 '22 20:09

chakrit