Difference between revisions of "Disable Right Click"

From KOP KB
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Honestly try your hardest not to do this. Also explain to the customer this does prevent people from taking their images.
+
Honestly try your hardest not to do this. This does prevent people from taking their images. Is best used in the body tag.
 
<syntaxhighlight lang="html4strict">
 
<syntaxhighlight lang="html4strict">
 
<div oncontextmenu="return false;">
 
<div oncontextmenu="return false;">
Line 7: Line 7:
 
whatever image or code
 
whatever image or code
 
</div>
 
</div>
 +
</syntaxhighlight>
 +
 +
==JS Disable==
 +
appears to work in everything that is not related to firefox
 +
 +
<syntaxhighlight lang="javascript">
 +
 +
<SCRIPT LANGUAGE="javascript">
 +
 +
function click() {
 +
if (event.button==2) {
 +
alert('Sorry, this function is disabled.')
 +
}
 +
}
 +
document.onMouseDown=click
 +
</SCRIPT>
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 23:55, 10 December 2015

Honestly try your hardest not to do this. This does prevent people from taking their images. Is best used in the body tag.

<div oncontextmenu="return false;">
<!-- 
Whatever content your wrapping it around goes in between these div tags
-->
whatever image or code
</div>

JS Disable

appears to work in everything that is not related to firefox

 <SCRIPT LANGUAGE="javascript">

function click() {
if (event.button==2) {
alert('Sorry, this function is disabled.')
}
}
document.onMouseDown=click
</SCRIPT>