title: Javascript redirect to hash from base url
body: <p>The following is not working (I just get a reload):</p>
  
  <pre><code>            location.host += "/#settings";
              location.reload();
  </code></pre>
  
  <p>How do I tell JS to navigate to a URL based on the existing url and totally reload that page (not just append the hash)?</p>
  
  <p>This also does not work:</p>
  
  <pre><code>             window.location.href = "/#settings";
  </code></pre>
  
  <p>My base url is <code>"http://localhost:sss/pricing"</code></p>
  
  <p>I want to redirect to <code>"http://localhost:sss/#settings"</code> with a reload.</p>
  
  <p>I don't want to type <code>localhost</code> anywhere.</p>
  
  <p>Even this gives me <code>settings#lol</code>:</p>
  
  <pre><code>            var desiredBase = window.location.protocol + "//" + window.location.host + "/";
              var path = '#lol';
              window.location.href = desiredBase + path;
              location.reload();
  </code></pre>