<i>The execCommand(&quot;cut&quot;&#x2F;&quot;copy&quot;) API is only available during a user-triggered callback, such as a click. If you try to call it at a different time, execCommand will return false, meaning that the command failed to execute.</i><p>Couldn&#x27;t you bypass this by creating an invisible button, and then simulating a click event?