Trending

How Do I Disable Right Click On My Web Page Or Blogger?

You can disable right-click on web page or blogger by using simple HTML and Scripts. And by using this script no one can able to do right click on your website or simple you can say by using that code it will simply disable right clicks on your web page and blogger etc.

{tocify} $title={Table of Contents}

By using HTML it will only block users to do a right-click but when users use the shortcuts key for direct inspect then they can able to go to your web page source code and also be able to do inspect by using the shortcut key.

To block users fully from doing right-click by using mouse or shortcut key you have to use some scripts and remember it slightly affect your website speed because every scripts or javascript need to execute to work on any site. By using the right-click disable script you can block users from using inspect tool using shortcut keys like:-

  • Right Click
  • F12
  • Ctrl + U
  • Ctrl + I
  • Ctrl + Shift + I
  • Ctrl + Shift + J
  • Ctrl + Shift + C
Note:- You have to use both HTML and Script code on your website to work Right Click Disable Properly.{alertInfo}

How to use the right-click disable HTML code on a web page?

You have to follow all steps to work the code properly:-

  1. You have to open your website code source or HTML edit page.
  2. Now, search for <body> tag. And change the <body> with a below new body tag.
    <body oncontextmenu='return false;'>

    Now, search for <body> tag. And change the <body> with a below new body tag. <body oncontextmenu='return false;'>

  3. After adding the new body tag click on save or save it.
  4. Then you have to add some scripts to your HTML code page.
  5. Search for </body>. Now Paste the below code just above the closing body tag (</body>).
    
      <!--Inspect Tool Blocker JQUERY For HTML USE <body oncontextmenu='return false;'>-->
    
    <script>
    
    document.onkeydown = function(e) {
    
    if(event.keyCode == 123) {
    
    return false;
    
    }
    
    if(e.ctrlKey &amp;&amp; e.shiftKey &amp;&amp; e.keyCode == &#39;I&#39;.charCodeAt(0)){
    
    return false;
    
    }
    
    if(e.ctrlKey &amp;&amp; e.shiftKey &amp;&amp; e.keyCode == &#39;J&#39;.charCodeAt(0)){
    
    return false;
    
    }
    
    if(e.ctrlKey &amp;&amp; e.keyCode == &#39;U&#39;.charCodeAt(0)){
    
    return false;
    
    }
    
    }
    
    </script>
    

    Search for </body>. Now Paste the below code just above the closing body tag (</body>).    <!--Inspect Tool Blocker JQUERY For HTML USE <body oncontextmenu='return false;'>-->  <script>  document.onkeydown = function(e) {  if(event.keyCode == 123) {  return false;  }  if(e.ctrlKey &amp;&amp; e.shiftKey &amp;&amp; e.keyCode == &#39;I&#39;.charCodeAt(0)){  return false;  }  if(e.ctrlKey &amp;&amp; e.shiftKey &amp;&amp; e.keyCode == &#39;J&#39;.charCodeAt(0)){  return false;  }  if(e.ctrlKey &amp;&amp; e.keyCode == &#39;U&#39;.charCodeAt(0)){  return false;  }  }  </script>

  6. Now, click on the save button or save it and now you have successfully made your website disabled for right clicks.

How to use the right-click disable HTML code on Blogger?

You have to follow the steps to work that code properly otherwise it will not work:-
  1. Open the blogger dashboard and select your blog from the left top corner.
  2. On the left sidebar click on the "Theme" option.
  3. When the theme is open click on "Edit Theme" from the drop-down menu.
  4. Inside "Edit Theme" you have to find some code and you can do that by clicking on Ctrl + F.
  5. Search for <body> and Replace the <body> with the below new provided body tag.
    <body oncontextmenu='return false;'>

    Search for <body> and Replace the <body> with the below new provided body tag. <body oncontextmenu='return false;'>

  6. Now, click on save the theme.
  7. Again, you have to find </body> by using Ctrl + F. And search </body>.
  8. After finding </body>, Paste the script code just above the body close(</body>) tag. And you can get that script code from below.
    
      <!--Inspect Tool Blocker JQUERY For HTML USE <body oncontextmenu='return false;'>-->
    
    <script>
    
    document.onkeydown = function(e) {
    
    if(event.keyCode == 123) {
    
    return false;
    
    }
    
    if(e.ctrlKey &amp;&amp; e.shiftKey &amp;&amp; e.keyCode == &#39;I&#39;.charCodeAt(0)){
    
    return false;
    
    }
    
    if(e.ctrlKey &amp;&amp; e.shiftKey &amp;&amp; e.keyCode == &#39;J&#39;.charCodeAt(0)){
    
    return false;
    
    }
    
    if(e.ctrlKey &amp;&amp; e.keyCode == &#39;U&#39;.charCodeAt(0)){
    
    return false;
    
    }
    
    }
    
    </script>
    

    After finding </body>, Paste the script code just above the body close(</body>) tag. And you can get that script code from below.

  9. After pasting the script code just above the </body>. Then click on the "Save Theme" button and you can successfully disable Right Click On Blogger.

What are the advantages of using the "Right Click Disable" code?

The advantages of using the right-click disable code are listed below:-
  1. No one can able to steal your website data.
  2. No one can able to reach your website source code.
  3. No one is able to copy your website CSS, and any script you use.

What are the disadvantages of using the "Right Click Disable" code?

The disadvantages of using the right-click disable code are listed below:-

  1. You are also not able to copy/paste any data from your own website.
  2. If your website is a tool where the user has to type something at this time using only able to type, he/she can't able to paste his date which he has written manually like in word counter wensite.

Does right-click disable script slow down the website speed?

Yes, it slows down the website speed not only this if you use any script in your website then it slows down your website. But if you use this script then it slightly changes on speed like if you have 100 Page Insight Speed Score and after using this script your website speed changes to 99 or 98.

So, this won't have much effect on your website speed but if you don't want this then you can search in google for other code. 

If any problems occur then feel free to ask. Thank You.

Post a Comment

Previous Post Next Post