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:-
- You have to open your website code source or HTML edit page.
- Now, search for <body> tag. And change the <body> with a below new body tag.
<body oncontextmenu='return false;'>
- After adding the new body tag click on save or save it.
- Then you have to add some scripts to your HTML code page.
- 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 && e.shiftKey && e.keyCode == 'I'.charCodeAt(0)){ return false; } if(e.ctrlKey && e.shiftKey && e.keyCode == 'J'.charCodeAt(0)){ return false; } if(e.ctrlKey && e.keyCode == 'U'.charCodeAt(0)){ return false; } } </script>
- 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?
- Open the blogger dashboard and select your blog from the left top corner.
- On the left sidebar click on the "Theme" option.
- When the theme is open click on "Edit Theme" from the drop-down menu.
- Inside "Edit Theme" you have to find some code and you can do that by clicking on Ctrl + F.
- Search for <body> and Replace the <body> with the below new provided body tag.
<body oncontextmenu='return false;'>
- Now, click on save the theme.
- Again, you have to find </body> by using Ctrl + F. And search </body>.
- 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 && e.shiftKey && e.keyCode == 'I'.charCodeAt(0)){ return false; } if(e.ctrlKey && e.shiftKey && e.keyCode == 'J'.charCodeAt(0)){ return false; } if(e.ctrlKey && e.keyCode == 'U'.charCodeAt(0)){ return false; } } </script>
- 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?
- No one can able to steal your website data.
- No one can able to reach your website source code.
- 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:-
- You are also not able to copy/paste any data from your own website.
- 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.