title: How to copy URL on button click?
body: <p>I am trying to copy the current page URL in the text area on button click. Somehow I have tried but is not working.
  <a href="http://www.w3schools.com/code/tryit.asp?filename=FAF25LWITXR5" rel="noreferrer">http://www.w3schools.com/code/tryit.asp?filename=FAF25LWITXR5</a></p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>
      function Copy() 
      {
          var Url = document.createElement("textarea");
          Url.innerHTML = window.location.href;
          Copied = Url.createTextRange();
          Copied.execCommand("Copy");
      }
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div&gt;
   &lt;input type="button" value="Copy Url" onclick="Copy();" /&gt;
   &lt;br /&gt;
   Paste: &lt;textarea rows="1" cols="30"&gt;&lt;/textarea&gt;
  &lt;/div&gt;
  
  </code></pre>