Reputation: 415
I am exposed to HTTP for several days, and today I encounter a problem as regards baidu search engine. Details as follow:
As I open http://www.baidu.com/ with desktop browser and type in some keyword, then press ENTER, the browser url displayed is something like http://www.baidu.com/#wd=stackoverflow&ie=utf-8
with stackoverflow
as the search keyword.
Please notice the anchor #wd here. It seems pretty strange to me though, eg. as to Google for example, it would be something like https://www.google.com/search?q=stackoverflow
without any anchor.
I use Fiddler (http://www.telerik.com/fiddler) to inspect the HTTP packet interaction, and curiously found something like GET /s?ie=utf-8&wd=linux HTTP/1.1
after several HTTP packet interaction.
In the whole process, the server only responses HTTP/1.1 200 OK
and there is no stuff like HTTP/1.1 302 Moved Temporarily
etc.
So how could it finally redirect to GET /s?ie=utf-8&wd=linux HTTP/1.1
, what does the browser do to the anchor #wd?
Thanks in advance.
Upvotes: 0
Views: 1373
Reputation: 57115
The component of the url after the #
sign is called the URL Fragment. It is not directly sent to the server as a part of the HTTP request (which is why you don't see it in Fiddler); it is only accessible by the JavaScript running on the page.
Some sites use URL fragments when they've used AJAX techniques to populate a page; see http://blogs.msdn.com/b/ieinternals/archive/2011/05/17/url-fragments-and-redirects-anchor-hash-missing.aspx for some discussion.
Upvotes: 1