Php MySQL

How To Disable Right-click And Copy-past In A Website

Disable Any Option In The Website

Hello friends, today I will tell you how to save your website’s content from being stolen and how you can rank your website, first of all, you have to disable right-click the mouse on your website and You will also have to disable copy-paste option so that no one can copy your contain and steal your website’s code. For this, you have to add a javascript to your website header. You can also add this script to the Blogger, WordPress, and local website and secure your website.

In this post, you will be given two types of javascript

(1)   block right-click

        <script language=javascript>
<!--
//Disable right click script - By www.BBeginner.com
//
var message="Function Disabled";
////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</script>

(2)   block copy-past

<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 false"); } </script>

How To Add These Code In Website

Step:1

Open your website’s source code and go the header section then past these code there

After Past these Code save your website

These codes are valid for any type websites such as Blogger, WordPress, Localhost etc.

  • Meta:-  how to disable right-click and copy-paste on the blogger website
  • Meta:-  how to disable right-click and copy-past on WordPress website
  • Meta:-  how to disable right-click and copy-past on website

leave a comment for any type of problem to code related thanks:- 

Kamal

My name is Kamalesh saini , working as e-mitra operator and web developer too. i am here to guide people who need help in learning php MySQL, HTML,CSS, and javascript.

2 comments

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.