Live data from Hacker News

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

news.ycombinator.com

21–30 of 71 posts

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

#21
post #14
post #8

Earlier quoted context omitted.

That's pretty neat. Didn't know that. Thanks!

And if you set num=0 then it returns the normal "did not match any documents" page: https://www.google.com/search?num=0&q=temperature+london Which seems like it could be used to fool someone into thinking there really are no results for a subject. Or to pretend Google search is broken ;)

Or tell the truth about the truth ;)

https://www.google.nl/search?num=0&q=the%20truth

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

#22
post #7

Earlier quoted context omitted.

Correct. The only service which can provide you with google queries is google analytics. So if you want the data, you are forced to help spread the google drag net across the internet.

No. Keywords do not appear in Google Analytics since search switched to HTTPS. The query strings are dropped going from HTTPS to HTTP. Keywords will show up as "(not provided)"(Disclaimer: I work at Google but I'm not on the search team. I do use Google Analytics.)

They drop them from https to https using this method as well. In this case, what is good for the user is amazing for Google. They are the only ones that get access to the query stream.

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

#23
post #6

If you are search from any place (toolbar, addressbar) other than google.com, your search query would be passed in as a query string. But once you are already on google.com search page, the entire page need not be reloaded. So google would fetch the search results for the new search string via a XHR and update the page. In fact if you search for https://www.google.com/search?q=wonderland#q=alice , the webpage would f…

They could use `pushState` to change the query without reloading the page?

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.

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

#24
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

So cool.

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

#25
post #8
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

That's pretty neat. Didn't know that. Thanks!

[deleted]

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

#26
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

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 in Chrome as well)

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

#27
post #19
post #13

Earlier quoted context omitted.

Interesting that your alice/wonderland example works. Would've thought Google would try to prevent that.

As far as Google are concerned it makes no difference if the query is a GET variable in the URL or a hash fragment that their JS code sends as a query after the search page is loaded. They both mean "load Google Search with this parameter from the URL".

Don't forget that the hash part is client sided; Google doesn't know about it until the page is loaded.

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

#28
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

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.

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

#30
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

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…

Set DuckDuckGo as your default search engine and you don't even need to do any configuring. You can then just type `!wiki India` or `!gi birds` or any other !bang: https://duckduckgo.com/bang
Post reply on HN