Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

copy text to the clipboard

const copyToClipboard = str => {
  if (navigator && navigator.clipboard && navigator.clipboard.writeText)
    return navigator.clipboard.writeText(str);
  return Promise.reject('The Clipboard API is not available.');
};
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #copy #text #clipboard
ADD COMMENT
Topic
Name
8+4 =