Monday, October 1, 2012

Handling hashChange event

If you intend to build site navigation based on hash values in your URL, one of the major problem you would come across is how to deal with old browsers like IE 7. These old browsers donot support "window.onhashchange".
If you are using jquery then you can initiate the following code if "window.onhashchange" is not detected.

  var url = $(this).attr('href');
  var hashvalue = url.substring(url.indexOf("#")+1,url.length);
  //perform some processing based on this value.