← All posts

Tutorials

Unblock copy, select and right-click on any page

A surprising number of sites still try to "protect" their content by disabling text selection, the copy command and the right-click menu. It rarely stops anyone determined, but it constantly annoys people who just want to grab a quote or a phone number. With JustZix you can switch all of it back on in seconds.

Why pages block copying

Sites disable copy and selection in three common ways: a CSS rule (user-select: none), JavaScript event listeners that call preventDefault() on copy, selectstart and contextmenu, and sometimes a transparent overlay on top of the text. JustZix lets you neutralise every layer because your rule runs in the page and you control both the CSS and the JS.

Step 1: force selection back on with CSS

Create a CSS rule in JustZix matched to the site (or to * for everything) and paste this. The !important flag overrides the site's own stylesheet.

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

This alone fixes the majority of "I can't highlight the text" cases. If the page still resists, the block is coming from JavaScript instead.

Step 2: stop the JavaScript handlers

Add a JS rule for the same URL. The trick is to register your listeners in the capture phase (the third argument true) so they run before the site's handlers, then call stopImmediatePropagation() so the site's blocking code never fires.

['copy', 'cut', 'paste', 'selectstart', 'contextmenu', 'mousedown'].forEach(function (type) {
  document.addEventListener(type, function (e) {
    e.stopImmediatePropagation();
  }, true);
});

JustZix runs your JS once per page load, so this attaches early and covers the whole document. Because you only stop propagation, the browser's default behaviour (actually copying, actually showing the menu) still works.

Step 3: clear inline handlers

Some pages set oncontextmenu="return false" directly on the <body> element. Capture-phase listeners do not always beat inline attributes, so wipe them too. This snippet is defensive: it checks the element exists before touching it.

var targets = [document.body, document.documentElement];
targets.forEach(function (el) {
  if (!el) return;
  el.oncontextmenu = null;
  el.oncopy = null;
  el.onselectstart = null;
  el.ondragstart = null;
});

Putting it together

For a stubborn site, use all three: the CSS rule plus a single JS rule combining steps 2 and 3. The combined JS rule looks like this:

['copy', 'cut', 'paste', 'selectstart', 'contextmenu', 'mousedown', 'dragstart'].forEach(function (type) {
  document.addEventListener(type, function (e) {
    e.stopImmediatePropagation();
  }, true);
});

var el = document.body;
if (el) {
  el.oncontextmenu = null;
  el.oncopy = null;
  el.onselectstart = null;
}

When the text is inside an overlay

If you can see the text but selection grabs an empty box, an invisible element sits on top. Find it in DevTools and disable pointer events with CSS:

.paywall-overlay,
.copy-guard,
[class*="overlay"] {
  pointer-events: none !important;
}

Be conservative with broad selectors like [class*="overlay"] — they can disable buttons you actually need. Prefer the exact class name once you have identified it.

Tips for reliable rules

Browse the ready-made examples for a one-click version of this rule, and if you have not installed it yet, download JustZix for Chrome, Firefox, Edge or Opera. Once copy works again, you may also want to read our companion post on auto-accepting cookie banners.

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