3 ms·
I was building an app that used pushState/replaceState recently instead of the hash bang syntax, but getting content navigation isn't easy. For example, when at
by antimatter15 16y ago
I was building an app that used pushState/replaceState recently instead of the hash bang syntax, but getting content navigation isn't easy. For example, when attaching the event handler to the links, you have to be careful not to make it trigger on middle or right clicks and you have to keep track of the scroll state so going back keeps the same behavior and also to take a copy of the previous selected text. Without all of that, intra-page navigation feels unnatural and uncanny.
- mcantor 16y agoHTML5 pushState/replaceState is the "correct" way to do this for compliant browsers, though... right?
- strager 16y agoGood points, but it seems some of that (scrolling, selection, form data, etc.) should be left to the browsers to fix/implement/deal with. Granted, it is a really bad user experience. Seems like this should be made a JS library in the meantime. (Hint, hint. =])