How to disable right click on website?

Disallow users to right click on your website

Many people are writing blogs and articles on their websites and blogs. They always have a similar problem that another peoples are copying their articles and posts of the blog.

How to disable right click on website?


To resolve this problem, here is a JavaScript which will be helpful for bloggers and online article writers.

<script type='text/javascript'>
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}
function reEnable(){
return true
}
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
</script>
<script language='JavaScript'>
<!-- //Disable right mouse click Script var message="Function Disabled!"; /////////////////////////////////// function clickIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function("alert(message);return false") // -->
</script>

How to use this code?

To use this code you should be follow these instructions:
  1. If you have a website then open the page with notepad on which you want to disable to do copy or other activities. Then paste this script just below the <head>.
  2. If you have blog then use EDIT HTML main frame html editor and paste this code just above the </body>.

JOIN US TODAY! with How To Learn Blog

Please note before commenting on this page.
1. Don't comment as for advertisement purpose.
2. Don't hyperlink your website inside comment box.
3. Abuses are strictly prohibited.
4. If necessary, you can post the only URL without any text hyperlink. ConversionConversion EmoticonEmoticon