title: Secret copy to clipboard JavaScript function in Chrome and Firefox?
body: <p><strong>Update</strong></p>
  
  <p>Looks like <a href="https://developers.google.com/web/updates/2015/04/cut-and-copy-commands?hl=en" rel="noreferrer">browsers are starting to support copy natively in JS</a></p>
  
  <hr>
  
  <p>In the console windows of both Chrome and Firefox on Mac I can execute</p>
  
  <pre><code>copy("party in your clipboard!");
  </code></pre>
  
  <p>and the text gets copied to my clipboard. I have searched SO and Google and can't seem to find anything on this. </p>
  
  <ul>
  <li>Are these specific to each browser?</li>
  <li>Where can I find more information on
  these JavaScript functions?</li>
  </ul>
  
  <p>Browser versions:</p>
  
  <p><img src="https://i.stack.imgur.com/KIiX5.png" alt="alt text">
  <img src="https://i.stack.imgur.com/dAsN7.png" alt="alt text"></p>
  
  <p>JavaScript returned from Chrome console when executing 'copy'</p>
  
  <pre><code>function (object)
      {
          if (injectedScript._type(object) === "node") {
              var nodeId = InjectedScriptHost.pushNodePathToFrontend(object, false, false);
              InjectedScriptHost.copyNode(nodeId);
          } else
              InjectedScriptHost.copyText(object);
      }
  </code></pre>
  
  <ul>
  <li>What does this code mean?</li>
  </ul>
  
  <p>Here are 2 screenshots of executing copy function in Chrome console with all chrome extensions disabled</p>
  
  <p><img src="https://i.stack.imgur.com/U3TBe.png" alt="alt text"></p>
  
  <p><img src="https://i.stack.imgur.com/7ccYY.png" alt="alt text"></p>