-1

/?q=#/ in Query String, sometimes I saw in URL of facebook and twitter, what it is and why is it used?

Please explain in detail. I query it most of time in google but have not found satisfactory results.

I think it used in Ajax based framework.

Rahul Murari
  • 439
  • 1
  • 5
  • 16

2 Answers2

3

It is for updating the page's URL without fully reloading the page. /?q= is just an empty variable in the query string. But, everything after a # is actually in the hash part of the URL. That was originally used to automatically scroll a page to an anchor (<a name="blah">). It is accessible via JavaScript, and because it doesn't reload the page, it is perfect for URLs that work when copy-pasted to the URL box, change when you do stuff on the page, but still keep everything loaded.

Shortly: /?q= is an empty variable in the query string, #/ and everything after that is data for JavaScript to process. The slash(es) in the hash string make it look like it is also a part of the directory structure.

PurkkaKoodari
  • 6,703
  • 6
  • 37
  • 58
2

Section 3 of RFC 3986 may be helpful.

The /?q= is a query string, where the parameter named q is blank/empty.

Everything after the # is called the fragment. Sometimes it's used to jump to a bookmark on the page, but, usually it's just some data that the Javascript running in your browser can use. If you change the part after # in the URL, your page doesn't reload, but, the Javascript in your browser can react to it.

Community
  • 1
  • 1
John Jesus
  • 2,284
  • 16
  • 18