Home » Web Tutorials » How to disable right click on website?

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”]
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”)
<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”) // –>

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>.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top