Get Hash Values using Hash key

by naveen

JavaScript

function GetHashParameterByName(name)
{
  var match = RegExp('[#&]' + name + '=([^&]*)')
                    .exec(window.location.hash);

    return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}

//var url ="http://www.google.com#access_token=asddf&expires_in=123";
//var token = GetHashParameterByName("expires_in");
//alert( token );