Copy-pasting on chrome using javascript: document.execCommand('paste') doesn't work
<p>I need to implement a feature that copy-pastes some custom data across our websites using javascript.</p>

<p>After a lot of stumbling blocks, <a href="https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript">this question</a>'s lead answer pointed me in the right direction.</p>

<p>Basically, to copy, I add a new <code>textarea</code> to my document, set its value to my desired text, and run <code>document.execCommand('copy')</code>.</p>

<p>So far so good.</p>

<p>I attempting to implement paste similarly, and there lies the problem.
I add a <code>textarea</code>, focus and select it, and run <code>document.execCommand('paste')</code>; but it doesn't work.</p>

<p>Here's a fiddle demonstration:</p>

<p><a href="https://jsfiddle.net/tusharx23/7zpjfh2h/1/" rel="nofollow noreferrer">https://jsfiddle.net/tusharx23/7zpjfh2h/1/</a></p>

<p>As you can see, the log says that 'paste was unsuccessful'</p>

<p>Can anyone help me get the paste to work?</p>

<p>Thank you.</p>