How to Disable right-click and text selection function in Blogger

Hello, friends welcome to Game Adda World. You might doesn't want to show visitors the source code of your website or you want to prevent visitors from copying your content then this tutorial is for you. In this tutorial, we are going to show you how to disable right-click and text selection function in Blogger. So without wasting any time let's start.

How does it work?

When visitors try to select the texts on your website then they cannot select the text on the website. When users try to right-click the visitors cannot right-click they get a popup message like this function disabled. 

Advantages

The visitors cannot copy your contents or cannot view your website source code because it will disable text selection and right-click.

How to disable right-click and text selection in Blogger?

First, go to Layout now click Add a Gadget anywhere in layout then select HTML/Javascript and copy this code and paste it on HTML/Javascript gadget
<script language=javascript>

<!--

var message="Right click function is 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>

<script src='demo-to-prevent-copy-paste-on-blogger_files/googleapis.js'>

</script>

<script type='text/javascript'>

	if (typeof document.onselectstart!="undefined" ) { 

		document.onselectstart=new Function ("return false" );

	} 

	else { 

		document.onmousedown=new Function ("return false" ); 

		document.onmouseup=new Function ("return true" );

	}

</script>
Now Save the gadget.

Now you successfully disabled text selection and right-click.

Conclusion

Hope this How to Disable right-click and text selection function in Blogger post will be useful to you. If you have any doubts related to this post ask me in the comment.

Thanks for visiting!

Comments



Font Size
+
16
-
lines height
+
2
-