Disable Right Click and Selection

Disable Right Click and Selection

Disable Right Click and Selection is very useful for you to protect the content of your website. By using this, the visitor cannot select an area of your page and right click on it. Disable Right Click and Selection is realy a simple code, but indeed it is very powerfull.

Lets just jump to the code for disable right click:

var msg="Right Click has been disabled!";//Give alert here
document.oncontextmenu=new Function("alert(msg);return false");//give alert
//document.oncontextmenu=new Function("return false");//open this row to give no alert

Lets just jump to the code for disable selection:

function stop(){return false;}
function allow(){return true;}
document.onselectstart=new Function ("return false")
if (window.sidebar){
	document.onmousedown=stop;
	document.onclick=allow;
}

Unfortunantely, several blog or public site have disabled the javascript like this wordpress that I use. Therefore I cant implement my own code in this page. However, I have tried Disable Right Click and Selection on local server and it work successfully. I also try Disable Right Click and Selection with IE8, Google Chrome 10.0.648.205, Safari 5.0.4,and FireFox 4.0b10.

Just copy this  into your HTML page. Hope Disable Right Click and Selection simple code can help you alot.

http://septiadi.com/2011/04/25/disable-right-click-and-selection/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: