tezvyn:

Manipulate Browser History with pushState and replaceState

Source: developer.mozilla.orgbeginner

Make a single-page app feel like a multi-page site. `pushState` changes the URL without a full page reload, creating a new browser history entry. This is essential for SPAs to enable shareable links and a working back button.

Make a single-page app feel like a multi-page site. `pushState` and `replaceState` let you manipulate browser history, changing the URL without a full page reload. This is how SPAs create shareable links and make the back button work as users expect. The footgun: `pushState` only changes the URL; you are responsible for listening to `popstate` events to render the correct view when the user clicks back or forward.

Read the original → developer.mozilla.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Manipulate Browser History with pushState and replaceState · Tezvyn