"Clearing url" removing hash between separate pages
<p>I have a tab system that works great on its own. The problem is that should someone click a link to another page with a simlar tab system, even with different classes, the past hash is being stored.</p>

<p>So, say they are on page 1 and the tab opened ends the url like:
/dept/waste-recycling-programs?whatToRecycle#whatToRecycle</p>

<p>then, going to page 2, which has a completely different url,
/dept/facilities/?goals2013#whatToRecycle</p>

<p>So someone had clicked on "2013 Goals" which leads to a different url and adds "?goals2013" like it should, but then it appends "#whatToRecycle" after that. Which was the last tab clicked on in the previous page with a tab system.</p>

<p>If I can just figure out how to call some function at page load that erases all ? and on, then it should work, I'm thinking.</p>

<p>The problem is that a left nav bar has all links to the specific tabs so that someone doesn't have to come to either page 1 or page 2 and then, click on say the third tab. They click on what would be the third tab on either page, hit the page and that tab is open.</p>

<p>HTML for the list of links:</p>

<pre><code>&lt;ul class="enviroNav"&gt;
    &lt;li class="bottomBorder"&gt;&lt;a href="?"&gt;WHAT WE DO&lt;/a&gt;&lt;/li&gt;
    &lt;li class="liWithSubs"&gt;&lt;a href="/departments/site-facilities/environment"&gt;ENVIRONMENT&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="/departments/site-facilities/iso-14001?iso14001"&gt;ISO 14001&lt;/a&gt;&lt;/li&gt;
    &lt;li class="doubleIndentLi"&gt;&lt;a href="/departments/site-facilities/iso-14001?environmentalPolicy"&gt;-Environmental Policy&lt;/a&gt;&lt;/li&gt;
    &lt;li class="doubleIndentLi"&gt;&lt;a href="/departments/site-facilities/iso-14001?impactAreas"&gt;-Impact Areas&lt;/a&gt;&lt;/li&gt;
    &lt;li class="doubleIndentLi"&gt;&lt;a href="/departments/site-facilities/iso-14001?goals2013"&gt;-2013 Goals&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="/departments/site-facilities/environment/waste-recycling-programs?whatToRecycle"&gt;Recycling/Waste&lt;/a&gt;&lt;/li&gt;
    &lt;li class="doubleIndentLi"&gt;&lt;a href="/departments/site-facilities/environment/waste-recycling-programs?whatToRecycle"&gt;-What To Recycle&lt;/a&gt;&lt;/li&gt;
    &lt;li class="doubleIndentLi"&gt;&lt;a href="/departments/site-facilities/environment/waste-recycling-programs?whereToRecycle"&gt;-Where to Recycle&lt;/a&gt;&lt;/li&gt;
    &lt;li class="doubleIndentLi"&gt;&lt;a href="/departments/site-facilities/environment/waste-recycling-programs?quickTips"&gt;-Quick Tips&lt;/a&gt;&lt;/li&gt;
    &lt;li class="doubleIndentLi"&gt;&lt;a href="/departments/site-facilities/environment/waste-recycling-programs?seeResults"&gt;-See Results&lt;/a&gt;&lt;/li&gt;
    &lt;li class="bottomBorder"&gt;&lt;a href="#"&gt;Energy&lt;/a&gt;&lt;/li&gt;
    &lt;li class="liWithSubs"&gt;&lt;a href="#"&gt;COMMUNITY&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;-Upcoming Events&lt;/a&gt;&lt;/li&gt;
    &lt;li class="bottomBorder"&gt;&lt;a href="?"&gt;-Past Activities&lt;/a&gt;&lt;/li&gt;
    &lt;li class="liWithSubs"&gt;&lt;a href="?"&gt;HOW WE&amp;#39;RE DOING&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;-See the Results&lt;/a&gt;&lt;/li&gt;
    &lt;li class="bottomBorder"&gt;&lt;a href="#"&gt;-Success Stories&lt;/a&gt;&lt;/li&gt;
    &lt;!--    &lt;li class="bottomBorder"&gt;&lt;a href="#"&gt;WHY WE CARE&lt;/a&gt;&lt;/li&gt;
    &lt;li class="bottomBorder"&gt;&lt;a href="#"&gt;EMPLOYEE WELLNESS&lt;/a&gt;&lt;/li&gt;--&gt;
    &lt;li class="bottomBorder"&gt;&lt;a href="/departments/site-facilities/ehs-training"&gt;ENVIRONMENTAL HEALTH &amp;amp; SAFETY(EHS) PROGRAM&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="?"&gt;COMMUNITY LINKS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>This routine works:</p>

<pre><code>    function setupSubNav(){
  pathName = window.location.href;
  $('.hiddenSection').css('display','none');
  pathArray = pathName.split('#');
  param = pathArray[pathArray.length-1];
  if(pathArray.length&gt;1){
    showWasteSection(param,$('.' + param + 'Trigger'));
  }
  else
  {
     if ($('body.fervens-a .pageTabsWaste li')) {
        var sectionNameWaste = $($('body.fervens-a .pageTabsWaste li')[0]).attr('class').split('Trigger')[0];
            showWasteSection(sectionNameWaste, $($('body.fervens-a .pageTabsWaste li')[0]));
        }
  }
    $('body.fervens-a .pageTabsWaste li').click(function(){
        if (!($(this).hasClass('current'))) {
            var sectionNameWaste = $(this).attr('class').split('Trigger')[0];
            showWasteSection(sectionNameWaste, $(this));
        }
    });
}
    function showWasteSection(sectionNameWaste,$navObj) {
    if (sectionNameWaste != 'whatToRecycle' &amp;&amp; sectionNameWaste != 'whereToRecycle' &amp;&amp;       sectionNameWaste != 'quickTips' &amp;&amp; sectionNameWaste != 'seeResults') {
        sectionNameWaste = 'whatToRecycle';
        $navObj = $($('body.fervens-a .pageTabsWaste li')[0]);
    }
        $('body.fervens-a .pageTabsWaste li').removeClass('current');
        $navObj.addClass('current');
        $('.hiddenSection').css('display','none');
        $('#' + sectionNameWaste + 'Content').css('display','block');
        window.location.hash = sectionNameWaste;
    }
</code></pre>

<p>and despite that I put that together some time ago, I didn't use it on more than one page back then so now I'm trying to force a clean wipe of the url. This is within a Drupal 6 site and it's on an intranet, internal so I have to support IE7+. Can't mess with the HTML5 storage or such.</p>

<p>Is there a way to wipe the url on clicking any link in the nav list? I'm not concerned with performance issues or iterations if that somehow figures in.</p>
