Copy to Clipboard

Copy to Clipboard

I want to copy some text in an HTML page to the clipboard when a button is clicked. Is there a method to do this in an onClick event?

It is not possible to access the clipboard on the user’s computer using JavaScript. As a result, your script can neither read the current contents of the clipboard nor replace the current clipboard with your text. Although it seems trivial to implement and could be important to users, this functionality was intentionally left unimplemented due to user security concerns.


Share the Post: