Re:Ask HN: Why does Google put the query in the URL hash ins...
by thomasahle on Monday January 09, 2017 @05:52AM
(#13355415)
Would that not remove the possibility for sharing or manually editing the URL? (I'm asking because I don't know how much cool stuff pushState can do.)
[ Parent
| on HN ]
Re:Ask HN: Why does Google put the query in the URL hash ins...
by dpark on Monday January 09, 2017 @09:58AM
(#13356724)
No, but it makes shared links less inefficient. If you share a URL like this, the server will not receive the hash on the initial request, so the js client will have to do the search as a second request after the page load. The reality is that most users will never even notice because it's still fast.
Manually editing the link causes that same fetch-render-refetch flow.
Edit: Oh, you were asking about pushstate. No, that specifically fixes the problem with the double fetch, so long as the server side and client side do the right thing to make the user see the same page for the same URL.
Pushstate just lets the JS client modify the URL without triggering a page reload, so the client can change the actual query param instead of the hash.
Re:Ask HN: Why does Google put the query in the URL hash ins...
by TazeTSchnitzel on Monday January 09, 2017 @06:05AM
(#13355475)
Not unless the server doesn't interpret the URL the same way.