Now make it multiplayer!
and blockchain
Play snake in the URL address bar
81–90 of 100 posts
Re: Play snake in the URL address bar
#82Re: Play snake in the URL address bar
#83Re: Play snake in the URL address bar
#84Re: Play snake in the URL address bar
#85Earlier quoted context omitted.
history.pushState vs history.replaceState
One thing to note about these two APIs is that they affect how the session history (the back/forward stack) behaves, but the global browser history (entries shown in the History tab) is separate. Most browsers record every change in the global history regardless of whether `history.pushState` or `history.replaceState` is used. The HTML Spec[0] is explicit about session history but does not define how global history s…
Re: Play snake in the URL address bar
#86Earlier quoted context omitted.
history.pushState vs history.replaceState
One thing to note about these two APIs is that they affect how the session history (the back/forward stack) behaves, but the global browser history (entries shown in the History tab) is separate. Most browsers record every change in the global history regardless of whether `history.pushState` or `history.replaceState` is used. The HTML Spec[0] is explicit about session history but does not define how global history s…
Is there a way to update the URL (ie: keeping it reactive in the address bar) without creating those history entries, or to ask the browser to squash the last entry it created into the previous one?
[1] https://nuqs.dev
Re: Play snake in the URL address bar
#87I just see the address? Safari on iOS.
See closely there should be snake in the bar as well, which responds if you use the arrows.
And in MacOS Safari, I see the game, but no clue how to play it... no matter what I do, it appears to reset to 0 points with the snake coming from the left?
Re: Play snake in the URL address bar
#88This is why i come to hackernews. :) made my day
Re: Play snake in the URL address bar
#89Re: Play snake in the URL address bar
#90Earlier quoted context omitted.
One thing to note about these two APIs is that they affect how the session history (the back/forward stack) behaves, but the global browser history (entries shown in the History tab) is separate. Most browsers record every change in the global history regardless of whether `history.pushState` or `history.replaceState` is used. The HTML Spec[0] is explicit about session history but does not define how global history s…
Thanks for the feedback, Vercel domain uses nuqs [1] (I'm the author) for URL state, and I agree flooding the browser history is a bad experience. Is there a way to update the URL (ie: keeping it reactive in the address bar) without creating those history entries, or to ask the browser to squash the last entry it created into the previous one? [1] https://nuqs.dev
Since there's no spec for global history and it's unlikely one will be introduced, the most practical solution to avoid flooding the browser history would be to debounce the changes.
This is the approach taken by Google Maps -- with maps being a well-known case where URL updates would clutter the history, as noted in the Bugzilla report.