Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Usage of Hash(#) in URL

I was wondering is there any use of hash other than as an anchor in URL. I read about it here getting the full url including query string after hash . What is state information for the client? Please help.

like image 897
Naman Avatar asked Feb 18 '14 09:02

Naman


2 Answers

The hash can be used also for single page applications, so instead of using it to navigate to a point in a page you use the hash as a means for navigated from page to page. The advantage of this is that it does not require a page refresh.

There is also a method called hashbanging which is used for single page applications and is used for helping ajax applications more indexible.

There are a few good articles on the subject

  • https://github.com/browserstate/history.js/wiki/Intelligent-State-Handling
  • http://danwebb.net/2011/5/28/it-is-about-the-hashbangs
  • https://developers.google.com/webmasters/ajax-crawling/
like image 107
Dominic Green Avatar answered Nov 05 '22 12:11

Dominic Green


Consider one page website, or website built fully on AJAX, without any page reloads.

#hash helps such applications to push state of the application to the client, this helps the application itself to be aware of the state and the client (and browser) to be aware of the state. This will also help the user to bookmark the application in its' current state and use back and forward buttons (browser history).

like image 44
Arman P. Avatar answered Nov 05 '22 12:11

Arman P.