Skip to main content

Command Palette

Search for a command to run...

Unblocking paste on some websites

Published
1 min read

Sometimes the best things happen when you're frustrated over some petty inconvenience. I had one such moment recently by getting frustrated by bad user experience in my bank website. Banks and government websites are the biggest offenders when it comes to user experience — they break basic browser features like the back button, copy-paste, etc.

I was logging into my banking website one day after my password expired. I generated a new, secure password, but they wouldn't let me paste it into the box. I tried typing one myself, but it wasn't "strong enough" apparently. I thought, enough is enough, and started looking at ways to disable paste-blocking on a per-site basis.

I know extensions exist for this, but I don't trust them around password fields. So I went with good ol' bookmarklets.

The one below, when clicked, strips out any paste blockers on the current page:

javascript: (function () {
  ["paste", "cut", "copy"].forEach(function (e) {
    document.addEventListener(
      e,
      function (e) {
        e.stopImmediatePropagation();
      },
      true,
    );
  });
})();

It's not bulletproof — won't catch every site or inline event listeners — but it works for the majority of cases and that's good enough for me.