Exercise 2: Why Bump the Version Parameter After Editing a Script — Possible Solution ==================================================================== WHAT THE VERSION PARAMETER ACTUALLY DOES, PER THIS CHAPTER ------------------------------ Per this chapter's own table, version is "appended to the URL for cache-busting - bump it when the file changes so browsers don't serve a stale cached copy." The version number becomes part of the actual URL the browser requests the file from (commonly as a query string, like main.js?ver=1.0), which is the specific mechanism that makes cache-busting work at all. WHY BROWSERS CACHE FILES IN THE FIRST PLACE ------------------------------ Browsers cache CSS and JavaScript files to avoid re-downloading the exact same file on every single page visit, which is normally a genuine performance benefit - once a visitor's browser has main.js, it doesn't need to fetch it again on their next visit to the same URL. WHY A CHANGED FILE WITH AN UNCHANGED VERSION CAUSES A REAL PROBLEM ------------------------------ A browser's cache is keyed by the exact URL requested - if the file's content changes on the server but the URL (including its version query string) stays exactly the same, the browser has no signal that anything is different, and will keep serving its own old, cached copy of the file instead of fetching the updated one. The developer's actual edits to the file would have no visible effect for any returning visitor whose browser already has the old version cached. WHY BUMPING THE VERSION SOLVES THIS ------------------------------ Changing the version from '1.0' to '1.1' changes the actual URL the browser requests the file from (e.g., from main.js?ver=1.0 to main.js?ver=1.1) - to the browser, this looks like a completely different resource it has never cached before, forcing it to fetch the new version fresh rather than reusing anything from its own cache of the old URL. WHAT WOULD GO WRONG FOR RETURNING VISITORS IF THE VERSION WEREN'T BUMPED ------------------------------ Returning visitors with the old file already cached would continue running the OLD version of the script or styling indefinitely, even though the server now holds updated code - potentially missing bug fixes, new features, or style changes the developer believed had already gone live, with no error or obvious symptom pointing back to "your browser is just using a stale cached file." WHY THIS WORKS AS AN ANSWER ------------------------------ It explains precisely what the version parameter does mechanically (changes the request URL), why browser caching alone would otherwise hide a genuine file update, and what concrete, confusing consequence follows for a returning visitor if the version is never bumped.