Tencent Music Tech Team
Nov 6, 2021 · Frontend Development
Web Routing in Single‑Page Applications: Hash, History, and Memory Modes
The article explains client‑side routing for single‑page applications, detailing three approaches—hash mode using location.hash and onhashchange, history mode leveraging the HTML5 History API’s pushState/replaceState with popstate handling, and memory mode storing routes in JavaScript or localStorage—plus their trade‑offs regarding URL readability, SEO, server configuration, and browser support.
Frontend DevelopmentSPAhash mode
0 likes · 11 min read