addEventListener('copy'... not working

Hi everyone!

I am trying to make this work:

document.addEventListener('copy', (e: ClipboardEvent) => {
  e.clipboardData.setData('text/plain', link);
  document.removeEventListener('copy', null);

It’s basically that, when the user clicks a button, some text (the link variable) gets copied. It works perfectly fine on a desktop web, but not on a mobile web. I honestly don’t know why.