Active links don't show the class name added when the page is refreshed or when the same link is clicked from another page
<p>Script:</p>

<pre><code>$(".classname li a").each(function() {
    var hreflink = $(this).attr("href");
    if (hreflink == location.href) {
        $(this).addClass("active");
    } else {
        $(this).removeClass("active");
    }
});
</code></pre>

<p>CSS:</p>

<pre><code>.classname li a.active{color:#ef9223;}
</code></pre>

<p>Whenever I do a page refresh, if the same link is on a different page, the active class is no longer applied to that link.</p>

<p>Actual exmple
i have the following Navigation links A B C D E F G H .... Z. And the same Navigation is in the main page(header section).. so when i click on any one link .. it needs to be active on when i arrive to any one A B C D E..or Z pages. And even on page refresh it needs to retain the active link. Hope that explains...and helps :)</p>

<p>Any help, inputs, solution would be much appreciated.</p>
