title: Getting current URL with JavaScript then using derived value in html code
body: <p>I have a simple question, but being a JavaScript newbie, I have no idea how to implement my findings.</p>
  
  <p>I found a little snippit that uses JavaScript to pull in the current URL, and load that value to a variable:</p>
  
  <pre><code>&lt;script type="text/javascript" language="javascript"&gt;
    window.onload = function () {
      var currentUrl = window.location.href;
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>so the value of <code>currentUrl</code> holds the current page's URL.</p>
  
  <p>What I need to know is how to use that value within my page's HTML. The application I am attempting to use this for is the facebook comments plugin.</p>
  
  <pre><code>&lt;div class="fb-comments" data-href="**currentUrl**" data-width="470" data-num-posts="2"&gt;&lt;/div&gt;
  </code></pre>