Site hosted by Angelfire.com: Build your free website today!

Right Click Mouse Block

On this lesson you will learn 2 different ways to block the right click on a mouse.

Both of these will NOT stop someone from viewing your source code. These are mainly designed to stop someone from taking items from your web page.
You can still go to the Menu or Task Bar and click on "View" then "Source" and the HTML Document will show up.

Disable Right Click (to View Source):
This neat little code is placed with in the BODY tag to block the right click view source code function.
Please ~ NOTE ~ This will also block the right click copy and the right click save as options.
<body oncontextmenu="return false">

Option 1 Example page..

Disable Right Click Function:
This one is a Javascript and it will Disable the right click mouse function.
Please ~ NOTE ~ This one will only work with Internet Explorer.

Please locate the */ var message="Function Disabled"; section with in this code. You can replace the {Function Disabled} with anything you would like. Please NOTE that the var message is what the viewer will see when He/She tries to use the right click on the mouse.
I like this JavaScript because you can place the coding between the <HEAD> and the </HEAD> tag, or you can simply place the coding below the <BODY> tag. Either way it will still work..

Option 2 Example page..

<script language=JavaScript>
<!--
/*
Disable right mouse click Script (By Crash @ http://walk.to/crash)
Submitted to and permission granted to
Dynamicdrive.com to feature script in it's archive
For full source code to this script and 100's more,
visit
http://dynamicdrive.com
*/ var message="Function Disabled";
function click(e) {
if (document.all) {
if (event.button==2||event.button==3) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// -->
</script>

If you are finished with the Right Click Mouse Block,
click on the Back link below to go back to the main page of lesson 3.

Back

Tutorials written by
© D & L Robinson's Graphic's Design
Exclusively for Heavens Angels
Mousepad Cloud.
All rights Reserved..