Avatar ·

How to change the URL in the browser address bar without reloading the page?

Hello everyone! I'm a beginner frontend developer and I've run into this problem. I have a single-page application (SPA) in pure JavaScript. The user clicks on links, and the content on the page changes dynamically (via fetch or simply hiding/showing blocks). Everything works fine, but there is one big problem: the address in the browser address bar remains the same. For example, the user clicked on "About Us", the content loaded, but the URL is still `https://mysite.com/`. Because of this: 1. The browser's "Back" button doesn't work — it just goes to the previous site, not to the previous "page" inside my application. 2. You can't send a friend a link to a specific section — they will always see the main page. I tried changing `window.location.href`, but it causes a full reload with