[X]

Disable Right Click

browser tricks 1998 partly

Blocks the context menu so nobody can steal your images. Allegedly.

In 2026: The menu really is suppressed, and it stops nobody: the images are already on their machine. It mostly annoys people who wanted to open a link in a new tab.

Where it came from: Free script archives from about 1998. Many versions, all equally ineffective. MDN

<script language="JavaScript">
function noRightClick() {
  alert("Sorry, right clicking is disabled! (c) my site");
  return false;
}
document.oncontextmenu = noRightClick;
document.onmousedown = function (e) {
  if ((e || window.event).button === 2) return noRightClick();
};
</script>

<!-- The whole page, the old way -->
<body oncontextmenu="return false" ondragstart="return false"
      onselectstart="return false">
sandboxed demo · breaks nothing but itselfrestart

More in browser tricks

all 25 in browser tricks › · the whole library ›