Blog with creative content

JavaScript Code To Disable Right Click on Blogger or Wordpress Blog.

In this post I published the JavaScript code to disable the right click function on your blog. We all know that how important the right click function in any internet browser. It is created to help us. We can use some advance options with the help of this function. But some people use it for the wrong purposes. That is why many bloggers want to disable right click function on their blog. So today I am publishing this simple JavaScript code to disable right click option of the mouse on your blog. This will work on all major internet web browsers. You can insert this code into your blogger/blogspot blog, wordpress blog and in your website also. I also published the steps below to add this code into blogger blog. So enjoy the code and don’t leave this page before sharing it from the scrolling social tab on the left hand side.



Code:

<script language="JavaScript">
<!--
var message="Function Disabled!";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
//visit http://www.hififun.net for blogging tutorials.
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>


Customize Code:

This JavaScript code will show an alert saying that 'Function Disabled!'. You can change this message with your own message. Just change the highlighted text in the blue color with your own message. 
Note: Do this carefully. This can prevent JavaScript from functioning properly.

Steps to disable right click option in blogger blog


Follow the below given steps to add the above given JavaScript into your blogger blog:

  • First of all login into your blogger account and select your blog.
  • Then click on the Layout option from the right hand sidebar.
  • After that, click on the ‘Add a gadget’ option and select ‘Text/JavaScript Code’ option.
  • Then copy & paste the above given JavaScript code here and click on ‘Save’ option.
  • Done!

0 comments:

Post a Comment

Related Posts

Popular Posts

Text Widget

Blog Archive

Powered by Blogger.