• Home
  • Frontend
  • Add info text if user copy text from website

Add info text if user copy text from website

linkaiyi
Follow
document.addEventListener('copy', (event) => {
  const pagelink = `\n\nRead more at: ${document.location.href}`;
  event.clipboardData.setData('text', document.getSelection() + pagelink);
  event.preventDefault();
});

work on modern browsers.

Object has 0 attachments

Was this article helpful?

This article is viewed 12 times!

Recent Viewed Articles

0 Comments

Leave a Comment

Support