Follow us

Sunday, October 10, 2010

Disable Mouse Right-Click


Description

This is a cross browser DHTML script that will prevent the default right menu from popping up when the right mouse is clicked on the web page.

Demo

Try right clicking anywhere on this Page.

Script

//Disable Mouse Right-click Script
//By TechnoScatter
//For full source code, visit http://technoscatter.blogspot.com

var message="Right Click Disabled";

function mousedown()
{
    return false;
}
    
function mouseup(e) 
{
    if(e != null && e.type == "mouseup")
    {
        if (e.which==2||e.which==3) 
        {
            return false;
        }
    }
}

function contextMenu()
{
    alert(message);
    return false;
}
    
if (document.layers)
{
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=mousedown;        
}
else
{
    document.onmouseup=mouseup;
    
}

document.oncontextmenu=contextMenu;

Download

Sr.NoDownloadSize
1.Disable Mouse Right-Click1.3 KB

Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments: on "Disable Mouse Right-Click"

Post a Comment