Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That’s because they implemented the link using history.pushState (default non-js link behaviour) when history.replaceState should be used instead.

It might still be valid to use a link for an on-page modal, for instance when it needs to be navigationable or should persist on a refresh.



> (default non-js link behaviour)

I mean, that's pretty much my whole point. Forget javascript (as the example in the article does), but links by default append to the state, because that is pretty much how browsers always worked before they even exposed the history API to javascript.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: