title: Copy text to clipboard now that execCommand("copy") is obsolete
body: <p>I just saw on the Mozilla page that execCommand() is obsolete <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand" rel="noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand</a></p>
  
  <p><em>"This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it."</em></p>
  
  <p>This is what I currently use to copy text to the user's clipboard when the user clicks a "copy text" button. Is there another way to do it?</p>
  
  <pre><code> var input = // input element with the text
   input.focus();
   input.setSelectionRange(0,99999);
   document.execCommand("copy");
   input.blur();
  </code></pre>
  
  <p>Edit: This <a href="https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript">How do I copy to the clipboard in JavaScript?</a> does not answer the question. It suggests the same obsolete solution.</p>