I have seen quite a lot of websites doing this (even stackoverflow itself) within their generated HTML source, accessing a specific version of a CSS or JavaScript file with GET parameters. What's the point of it?
Example:
<link rel="stylesheet" href="http://sstatic.net/so/all.css?v=6230">
<script type="text/javascript"
src="http://sstatic.net/so/js/master.js?v=6180"></script>
Is it simply a manner of coherence or best practice? Is it simply so that clients with old cached versions on their browsers are forced to update their outdated version?
To include an external JavaScript file, we can use the script tag with the attribute src . You've already used the src attribute when using images. The value for the src attribute should be the path to your JavaScript file. This script tag should be included between the <head> tags in your HTML document.
So, what is the difference between HTML and CSS? Quite simply, HTML (Hypertext Markup Language) is used to create the actual content of the page, such as written text, and CSS (Cascade Styling Sheets) is responsible for the design or style of the website, including the layout, visual effects and background color.
On the web browser menu click on the "Edit" and select "Preferences". In the "Preferences" window select the "Security" tab. In the "Security" tab section "Web content" mark the "Enable JavaScript" checkbox. Click on the "Reload the current page" button of the web browser to refresh the page.
Adding JavaScript into an HTML Document You can add JavaScript code in an HTML document by employing the dedicated HTML tag <script> that wraps around JavaScript code. The <script> tag can be placed in the <head> section of your HTML or in the <body> section, depending on when you want the JavaScript to load.
Is it simply so that clients with old cached versions on their browsers are forced to update their outdated version?
Exactly.
Check out this question for details, further links and discussion and this question on how Stack Overflow itself employs the method.
Yes, it is for bursting browser and proxy caches. There's no other purpose.
Well, theoretically you can dynamically generate javascript and then you'll need those parameters. JSONP works that way for example. But mostly it is for invalidate caches.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With