Disable right click without js and css

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

I noticed that right-clicking is disabled. I always have JavaScript turned off, so I started deleting node by node, css in turn in Firebag, but did not recognize what disables right click.

How it works?

This is not the first time I see this, so I'm curious about this trick.

+8
source share
6 answers

This is done using javascript.

I disabled javascript and I can right click. It is disabled using:

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

Your browser may have a problem, the site is accessible to me.

+7
source

On the tag body, do the following:

 <body oncontextmenu="return false"> ... </body> 
+14
source

You can use user-select in CSS for any elements you don't want to click on. Options are needed for some older browsers. In the following way;

 -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; 
+3
source

This is a simple piece of Javascript.
Disabling Javascript on the page eliminates the effect, you may have forgotten that you enabled it in your browser.
At the top of their <body> :

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

The best way to do this is:

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

Good luck.

0
source

Or you can always make this simple method

add the oncontextmenu handler to it as

 <body oncontextmenu='return false;' > 
-2
source

Source: https://habr.com/ru/post/1201520/


All Articles