4 ms·
To be honest, using replaceState for this doesn't seem to make sense to me. A user would probably want to go backward and forward through this using browser his
by 9point6 12y ago
To be honest, using replaceState for this doesn't seem to make sense to me. A user would probably want to go backward and forward through this using browser history navigation (for instance using the navigation buttons on their mouse).
If you're launching a link from a page you expected to come back to, surely opening the link in a new tab would be the way to accomplish this?
- leeoniya 12y agopersonally, i've always used arrow keys, swipes, pgup/pgdn to nav between slides. i want a single-action "exit slide deck to previous page", and the browser's back is the logical place for that to be, imho.
- jmathai 12y agoI think the lines between a single page app and full page reloads needs to be blurred. Most people won't know the difference and the back button needs to behave consistently. For that reason, I think that pushState here would make more sense. The state of the page does, after all, change.
- leeoniya 12y agoit's not a mental "context switch", though. i think the way android has the back button implemented is very sensible.
- lobster_johnson 12y agoYelp does this with its photo gallery, and it's really annoying. When the user is in a linear sequence such as a slide deck, photo gallery or similar, the "previous"/"next" buttons don't map to the browser's back/forward buttons, they navigate the sequence. Littering the history with the navigation history of this sequence does not make sense. However, it'd be nice if browsers could perhaps record the history (perhaps as some kind of sub-tree history), allowing me to see that I not only visited this slide deck, but that I also visited these specific slides.
- Touche 12y agoThere's no real distinction. If the slides were implemented as separate pages you would get a new entry in your history as you navigate through each of them. Back doesn't mean to go back to the previous domain; it means the previous page. You don't think the slides should be separate pages, but that would mean you couldn't link to them.
- lobster_johnson 12y agoAnd that's bad. A lot of people pine for the simplicity of the early days of the web, but single-page pagination was arguably even more horribly broken then.
- leeoniya 12y agowith replaceState, you get the best of both worlds - bookmarkable slides and no history foo.
- nilliams 12y agoExcept you can accidentally exit the deck when you actually meant to just go to the previous slide. I don't think this is better personally. I prefer the use of pushState and back button taking me to the previous slide. If I really want to back all the way out of the slide deck I will notice after a couple of clicks I need to do something further to go 'all the way back' and right click the back button and click a 'non-slide-deck' selection from that menu.