SUBSCRIBE OUR YOUTUBE CHANNEL 👉
Join in Google News
If You Want Adsense Approval for your blog Contact Us Adsense Ready theme Now!
Posts

How to make a website or blog not CTRL+U and right click

 

Hi Web Developers! back again with the tech teacher. this time the tech teacher will share a tutorial on how to make a website or blog not CTRL+U and right-click. For masters, masters, and the like, please correct me if something isn't quite right, but I don't think there is and for those of you who are looking at this article, please follow it and try it on your respective computers. Ok, continue to the tutorial.

Surely all of you don't want anyone to see your website code, or someone trying to copy your article? Now, in the way that we will discuss this time, the code for our website or blog cannot be seen by Ctrl +U  or copied by Right click. Here we will take advantage of a redirect or redirect using the JavaScript function, when our website or blog is ctrl+u and right -click it will to a certain page that we have specified.

To do so, please look at the code below:

First

Add the javascript code just above the closing body. </body>

<script type='text/javascript'>

function redirect1(e){if(e.ctrlKey&&85==e.which)return window.location.replace("https://Fill in your page URL"),!1}
function redirect2(e){if(3==e.which)return window.location.replace("https://Fill in your page URL"),!1}
document.onkeydown=redirect1,
document.oncontextmenu=redirect2;

</script>

Please fill in the redirect URL with the URL you want.

for example, I redirected to the URL https://habibkhan-tech.blogspot.com/

So it's written like this:

<script type='text/javascript'>

function redirect1(e){if(e.ctrlKey&&85==e.which)return window.location.replace("https://https://habibkhan-tech.blogspot.com/"),!1}
function redirect2(e){if(3==e.which)return window.location.replace("https://https://habibkhan-tech.blogspot.com/"),!1}
document.onkeydown=redirect1,
document.oncontextmenu=redirect2;
</script

if something is unclear please write in the comment section.


Read AlsoHow to prevent a website or blogger from being inspected by the Inspect Element
How to make the blog display a warning when JavaScript is turned off in the browser 

Try these codes in your editor to see the result by yourself.

Hope it'll be useful, thank you.

Post a Comment