I want to create a simple chrome extension that replaces the url that you copied from the “share > Copy link” button of reddit with a short link, but I don’t know how to listen to the event of that specific button click or the copy to clipboard event triggered by the button click.
I tried using
document.addEventListener('copy', onCopy, true);
to trigger onCopy
whenever something is copied to clipboard, but it seems to only trigger on copy events from context menu, not those from webpage elements.
I’m a beginner in javascript and chrome extension so every advice is appreciated.