DEV Community

Discussion on: Add a "Copy Link to Clipboard" button to your website in 10 lines of code

Collapse
 
pcjmfranken profile image
Peter Franken

FYI You can use the native clipbloard API writeText method like so navigator.clipboard.writeText(window.location.href) and get rid of the entire hidden textarea function.