Join our Telegram group ! Join now!

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

1 min read

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!

Rate this article

You may like these posts

  • Hello friends, Welcome to Game Adda World. You might be want to know how to add a download button timer to your blog posts. So we published a post for you about how to add a downlo…
  • Hello, friends welcome to Game Adda World. Nowadays you might see many websites using star ratings on their websites and you might be thinking about how to add the star rating…
  •  Hello friends, Welcome to Game Adda World. Nowadays we can see many websites using the recent comments widget on their website. So you might be thinking about how to add…
  • Hello friends, Welcome to Game Adda World. You might be thinking about making your Blogger blog about page too stylish. Here we published a tutorial on how to make a stylish about …
  • Hello friends, Welcome to Game Adda World. You might be thinking about how to add related posts in Blogger blog post. So here we published a tutorial for you about how to add relat…
  • Hello, friends welcome to Game Adda World. Nowadays you might be seen reading the progress bar on some of the websites. You might be thinking about how to add a reading progress ba…

Post a Comment