Live data from Hacker News

Ask HN: Why does Google put the query in the URL hash instead of query string?

news.ycombinator.com

61–70 of 71 posts

Re: Ask HN: Why does Google put the query in the URL hash instead of query string?

#61

Earlier quoted context omitted.

It's not that cumbersome in Chrome. Right click the URL bar -> "Edit search engines" -> Find the search engine you'd like to easily search, double click the second column and enter a keyword for it. For example, for wikipedia, I have "wp" as a keyword. In the URL bar, you can just type "wp " and you can search wikipedia.

you don't even have to do any configuration. after you've used a search box that's correctly formatted (like wikipedia's is) chrome automatically offers you the option to "press tab to search" when you start typing that's site's url.

Yep, I use this feature all the time and I think there's only ever been one or two sites I've had to set it up for manually. For most sites, Ctrl+T works just fine without me having to configure anything.

Re: Ask HN: Why does Google put the query in the URL hash instead of query string?

#62

Earlier quoted context omitted.

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.)

Not unless the server doesn't interpret the URL the same way.

The fragment of a URL is not sent to the server as part of an HTTP request

Re: Ask HN: Why does Google put the query in the URL hash instead of query string?

#63
post #4

On a related note, and probably obvious to many, I've just discovered I can make a nice little link to a one-result search, handy for a bookmark. Things like current temperature and forecast I don't want a dedicated app for when a simple search is more efficient... https://www.google.com/search?num=1&q=temperature+london

Very cool, thanks!

Re: Ask HN: Why does Google put the query in the URL hash instead of query string?

#64
post #55
post #54

Earlier quoted context omitted.

Graceful degradation/progressive enhancement is a thing, though.

The amount of money Google makes supporting older browsers is most likely measured in billions. Not to mention, why fix something that isn't broken? There are cases for it, but it's roughly the same tech that it was 4 years ago. What would they gain by spending developer time on it?

Perfect. They definitely don't need optimization for search engines, which is probably the most important reason to a clean URL.

Re: Ask HN: Why does Google put the query in the URL hash instead of query string?

#65
post #4

On a related note, and probably obvious to many, I've just discovered I can make a nice little link to a one-result search, handy for a bookmark. Things like current temperature and forecast I don't want a dedicated app for when a simple search is more efficient... https://www.google.com/search?num=1&q=temperature+london

You still get the google "applet" + 1 search result, any ways to get only the "applet"?

Re: Ask HN: Why does Google put the query in the URL hash instead of query string?

#66
post #55
post #54

Earlier quoted context omitted.

Graceful degradation/progressive enhancement is a thing, though.

The amount of money Google makes supporting older browsers is most likely measured in billions. Not to mention, why fix something that isn't broken? There are cases for it, but it's roughly the same tech that it was 4 years ago. What would they gain by spending developer time on it?

I suspect they spend a ton of developer time. It is their #1 source of income. What they won't do is releasing it unless it is 99.9% certain that it yields an improvement.

Re: Ask HN: Why does Google put the query in the URL hash instead of query string?

#67
post #46

Earlier quoted context omitted.

"never sent to the server" It's sent in a separate request.

That's because a request is manually created with javascript; this is not because it's part of the url. If you append #something to most random url's, nothing will happen (unless specific behaviour was written to do so).

Yes, I know.

Re: Ask HN: Why does Google put the query in the URL hash instead of query string?

#68

Earlier quoted context omitted.

Yes, and if you're using Firefox, you can this with the knowledge of its Smart Keywords to create super quick shortcuts! https://support.mozilla.org/en-US/kb/how-search-from-address... For example, I directly go to Wikipedia's page on "India " by typing wp India in my address bar using these search keywords, or search images of birds on google by typing gi birds in it. (There's a rather cumbersome way to do the same…

It's not that cumbersome in Chrome. Right click the URL bar -> "Edit search engines" -> Find the search engine you'd like to easily search, double click the second column and enter a keyword for it. For example, for wikipedia, I have "wp" as a keyword. In the URL bar, you can just type "wp " and you can search wikipedia.

You don't even need to use the tab key. It automatically works for me just from pressing space after the keyword in Chrome. In the end, the usage is identical to FF.

Re: Ask HN: Why does Google put the query in the URL hash instead of query string?

#69
post #54
post #23

Earlier quoted context omitted.

They could if they were building it now. IE got pushState support in IE 10 in 2012. The hash state has been there since Instant Search was launched in 2010.

Graceful degradation/progressive enhancement is a thing, though.

Consistent and long-lasting support is a thing too.

Rare on today's web, but still a thing.

Re: Ask HN: Why does Google put the query in the URL hash instead of query string?

#70

I think they did it to reduce stability and occasionally render blank results pages.

I've lost count of the amount of times I've had to force-refresh the page and enter my query all over again because of this.
Post reply on HN