title: Decode URL on Mobile from '%7C' to '|'
body: <p>We are using the code below to be able to link to a specific tab on our website.</p>
  
  <p>As it is currently made, it allows us to link to the specific tab by adding #member-tabs|3 to the URL, where member-tabs is the class, 3 is the tab to open, and they are separated by a "|".</p>
  
  <p><strong>The Problem</strong>: The symbol "|" is being encoded as "%7C", but is failing to be decoded on phone/tablet. I tried adding <code>replace('%7C', '|')</code>, but it didn't solve the issue.</p>
  
  <p>Example: <a href="https://test.radacutlery.com/fundraising/tabs/#member-tabs|3" rel="nofollow noreferrer">https://test.radacutlery.com/fundraising/tabs/#member-tabs|3</a></p>
  
  <pre><code>&lt;script&gt;
  
      function _setTab(){
          // get current hash value
          var curHash = window.location.hash.substr(1);
          // only continue if hash provided and scoped to member tabs
           if( !curHash || !curHash.match('member-tabs') ){ return false; }
          // split and int val tab num
          curHash = parseInt(curHash.replace('%7C', '|')split('|')[1]);
  
          // testing the decodeURI
          decodeURI(curHash)
  
          // ignore if tab is current state
          if( curHash === window._tabSelected ){ return false; }
          // set current tab to window
          window._tabSelected = curHash;
  
          // add click event to tab selected
          switch(curHash){
              case 0:
              case 1:
              case 2:
              case 3:
              case 4:
                  jQuery('#member-tabs .et_pb_tab_'+curHash+' a').click();
              break;
  
              default:
                  return false;
              break;
          }
  
          // scroll to tabs container
          _scrollToTabs();
      }
  
      // scroll to member tabs container with 50px offset
      function _scrollToTabs(){
          var oTabs = jQuery('#member-tabs');
          if( oTabs.length &gt; 0 ){
              jQuery('html,body').animate({
                  scrollTop: (oTabs.offset().top - 50)
              }, 1000);
          }
          return false;
      }
  
      // set falsey state for tab selected on load
      window._tabSelected = false;
  
      // attach to window load because the tabs are initialized later in document
      jQuery(window).on('load', function(){
          // check for initial hash state
          _setTab();
  
          // add hash change window listener
          jQuery(window).on('hashchange', function(){
              _setTab()
          });
  
      });
  &lt;/script&gt;
  </code></pre>