Want to protect your source
code? Using this code will prevent the vast majority of users from
right-clicking over a page and choosing "View source", or
right-clicking over an image and saving it. There are other ways to view the
code, though... This is not always a wise technique to use - it would have to
be a very special piece of code to want to hide, and those who would want to
steal it will always be able to find a way to see it.
Try right-clicking on this
page as an example.
<SCRIPT
TYPE="text/javascript">
<!--
//Disable right click script
//visit http://www.rainbow.arch.scriptmania.com/scripts/
var message="Sorry, right-click has been disabled";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</SCRIPT>
Place the above code into <HEAD></HEAD> of your
HTML. ...... <!--
//Disable right click script
//visit http://www.rainbow.arch.scriptmania.com/scripts/
var message="Sorry, right-click has been disabled";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</SCRIPT>
To disable the IE imagetoolbar also add the META TAG below to the
HEAD
<META HTTP-EQUIV="imagetoolbar"
CONTENT="no">
|