title: How to use JavaScript variable in an HTML link
body: <p>The website that I am working on has a <code>&lt;base&gt;</code> tag point to a different URL than the one that the website has. What I would like to do is get around the <code>&lt;base&gt;</code> tag by using the trueURL bellow to find the url of the webpage, because i need it to construct some internal anchors, because i need the actual url of the website so the internal anchors work correctly. </p>
  
  <p>The issue that im having is that i don't know how i should use the url that i store in my trueURL variable. Is it possible to use it and then add extra extensions to the url to get it to point to my anchors? Below is a rough example of what I would like to be able to do</p>
  
  <pre><code>var trueURL = window.location.href;
  
      &lt;html&gt;
  
      &lt;ol&gt;
          &lt;li&gt;
              &lt;a href= [trueURL] + "#link1"&gt;Link1&lt;/a&gt;
          &lt;/li&gt;
  
          &lt;li&gt;
              &lt;a href= [trueURL] + "#link2"&gt;Link2&lt;/a&gt;
          &lt;/li&gt;
  
          &lt;li&gt;
              &lt;a href= [trueURL] + "#link3"&gt;Link2&lt;/a&gt;
          &lt;/li&gt;
      &lt;/ol&gt;
  
      &lt;/html&gt;
  </code></pre>
  
  <p>Therefore in the end i would like to have a link that looks like trueURL#link3.</p>
  
  <p>Thanks in advance,</p>
  
  <p>:D :D</p>