14

This is a random Chinese website http://www.soap-china.com/index.asp

I noticed that right click is disabled. I always have JavaScript off, so I started delete node by node, css line by line in Firebag, but didn't find out what is disabling right click.

How does it work?

This is not first time I see this, so I am curious about this trick.

Qiao
  • 16,565
  • 29
  • 90
  • 117
  • Wow, that’s really something. I would have guessed `pointer-events: none` (since selection doesn’t work either), but it’s not that. Flash, maybe, but that’s not everywhere. Good question! – Ry- Aug 31 '14 at 22:27
  • There’s the `onselectstart="return false"`, but that is, of course, JavaScript… – Ry- Aug 31 '14 at 22:31
  • Seams like NoScript bag, asked here: https://forums.informaction.com/viewtopic.php?f=7&t=20026 – Qiao Aug 31 '14 at 22:51

5 Answers5

30

On the body Tag do this:

<body oncontextmenu="return false">
...
</body>
Umer Qureshi
  • 1,736
  • 2
  • 20
  • 22
14

It is done with javascript.

I have disabled javascript and I can right-click. It disables with:

<script language="JavaScript">
document.oncontextmenu =new Function("return false;")
</script>    
<body onselectstart="return false">

There might be an issue with your browser, the site is online for me.

Claudiu Creanga
  • 8,031
  • 10
  • 71
  • 110
  • 1
    Yep. That is strange, but NoScript doesn't stop this script. So it is NoScript bag. I should check default javascript off. – Qiao Aug 31 '14 at 22:43
6

You can use user-select in CSS on any elements you don't want to be clicked on. Variants are needed for some older browsers though. As follows;

-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
worldofjr
  • 3,868
  • 8
  • 37
  • 49
1

The best way to do this :

<script type="text/javascript">
document.oncontextmenu =new Function("return false;")
document.onselectstart =new Function("return false;")
</script>

Good luck.

HichamEch
  • 635
  • 1
  • 10
  • 18
-4

Or you can always do this simple method

add the oncontextmenu handler to it as

<body oncontextmenu="return false">