← All posts

Tutorials

Unblock copy, select and right-click on any page

You hit an article, you want to copy one paragraph into your notes — and the page will not let you select text. Right-click does nothing. That is not a browser bug, it is a deliberate block in the page's JavaScript. This article shows how to lift it with a single JustZix rule.

How pages block copying

There is no "read-only mode" in HTML. A page that blocks selection does it in two ways:

Both can be undone, because both run in the browser — and you have full control over your own browser.

Is this legal?

Yes. The text is already on your screen — the page sent it to you. Lifting the copy block circumvents no content protection, because there is none; it is only a UX nuisance. Copyright in the text itself is a separate matter — what you do with the copied fragment is up to you.

The rule — CSS plus JS

Set the URL pattern to the page that annoys you (or * globally). In the rule's JavaScript tab, paste:

['copy', 'cut', 'contextmenu', 'selectstart', 'dragstart']
  .forEach(evt =>
    document.addEventListener(evt, e => e.stopPropagation(), true)
  );
const s = document.createElement('style');
s.textContent =
  '*{user-select:text!important;-webkit-user-select:text!important}';
document.documentElement.appendChild(s);

How it works

stopPropagation in the capture phase

The third argument of addEventListener set to true means the capture phase. Our listener catches the event before it reaches the page's handler and calls stopPropagation() — propagation stops, and the page handler (the one with preventDefault()) never receives the event.

The injected style

The second block adds a CSS rule with user-select: text !important. The !important beats any user-select: none from the page. We inject it from JS (rather than as the rule's CSS) so it lands at the very end of the cascade and is sure to win.

The CSS-only variant

If the block is purely CSS, the JS is unnecessary — the rule's CSS tab is enough:

* { user-select: text !important; -webkit-user-select: text !important; }

Try this first. If selection still does not work, the page blocks in JS too and you need the full version.

Pitfalls

See also

Install JustZix — and copy from every page that tries to stop you.

Rate this post

No ratings yet — be the first.

Try it yourself

Install JustZix and paste any snippet from this article. Two minutes from zero to a working rule across all your devices.

Get JustZix

Features · How it works · Examples · Use cases