Skip to content

Instantly share code, notes, and snippets.

@liuliangsir
Forked from Gustavo-Kuze/force-ctrl-c-v.md
Created February 4, 2023 05:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liuliangsir/0bcdad9785ee25c19f4577aa8c99d466 to your computer and use it in GitHub Desktop.
Save liuliangsir/0bcdad9785ee25c19f4577aa8c99d466 to your computer and use it in GitHub Desktop.
Enable copy and paste in a webpage from the browser console
javascript:(function(){
  allowCopyAndPaste = function(e){
  e.stopImmediatePropagation();
  return true;
  };
  document.addEventListener('copy', allowCopyAndPaste, true);
  document.addEventListener('paste', allowCopyAndPaste, true);
  document.addEventListener('onpaste', allowCopyAndPaste, true);
})(); 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment