Copy current url button - Javascript
<p>okay it might be something simple or completely wrong however I'm trying to create a button to copy current URL to clipboard, this is what I currently have, I'm not too familiar with javascript so this is from a few sources mixed together and hoping for the best.</p>

<pre><code>&lt;button onclick="CopyLink()"&gt;Click me&lt;/button&gt;
&lt;script&gt;
function CopyLink() {
window.clipboardData.setData("Text", location.href);
}
&lt;/script&gt;
</code></pre>

<p>Any help would be great thanks!</p>