Heads up! This post was written 14 years ago. Some information might be outdated or may have changed since then.
function getUrlHashParams() {
    var hashParams = {};
    var e,
        a = /\+/g,
        r = /([^&;=]+)=?([^&]*)/g,
        d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
        q = window.location.hash.substring(1);
    
    while (e = r.exec(q))
        hashParams[d(e[1])] = d(e[2]);
    
    return hashParams;
}
Малка javascript функция която взима hash параметрите от url адреса и ги "връща" като обект. Примерно:
URL: http://example.com/#pg=1&sort-gsm=asc
{
    pg: "1",
    sort-gsm: "asc"
}

Back to all posts