Skip to content

Re-enable copy/paste on a website

Published: at 09:00 PM

Some sites disable copy/paste, especially annoying when you just want to grab a snippet of text.

The fix: intercept the event before their handler runs, using stopImmediatePropagation().

(() => {
  const allowCopyAndPaste = (e) => {
    e.stopImmediatePropagation();
  };
 
  ["copy", "paste"].forEach(event =>
    document.addEventListener(event, allowCopyAndPaste, true)
  );
})();

Run the snippet once in the browser dev console. Refreshing the page will undo it.