Skip to content

Instantly share code, notes, and snippets.

@nikhil-thakkar
Forked from Gustavo-Kuze/force-ctrl-c-v.md
Created July 12, 2022 17:23
Show Gist options
  • Save nikhil-thakkar/f3aca9fec1a7869a1ca0ff56e3548ccb to your computer and use it in GitHub Desktop.
Save nikhil-thakkar/f3aca9fec1a7869a1ca0ff56e3548ccb 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