Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

enable paste on website with javascript

I'm directly quoting/ripping off https://stackoverflow.com/questions/32784487/script-to-enable-paste-on-website/68414487#68414487 here. Because it's incredibly useful.

I found this simple script did work [for enabling "paste" on website]:

document.addEventListener('paste', function(e) {
  e.stopImmediatePropagation();
  return true;
}, true);

Which was found here: https://www.howtogeek.com/251807/how-to-enable-pasting-text-on-sites-that-block-it/

Edit: May need to stop propagation for keydown as well for some websites.

document.addEventListener('keydown', function(e) {
  e.stopImmediatePropagation();
  return true;
}, true);

Paste that into the console of devtools (F12) and carry on with business.

Comments