Disable Ctrl+U [Page Source] of your website using JavaScript

Saturday, June 18, 20160 comments


I have recently disabled the ‘ctrl+u’ feature of my blog and the only reason I did it because I have started to notice that most of my contents are getting copied. I never thought that some bloggers would even go through my page source and steal my content. WOW! The first thing I did on my blog was disable the content selection and right click and I thought that’s it, my blog is safe. But later on, I came to know that there’s some more ways for stealing contents and they are even doing it. So, I figured a way out to disable viewing my page source using shortcut keys [Ctrl+U] and also, there’s one more way to steal contents, which is Ctrl+P (Print) and I disabled that one too. In order to protect your work, you must do these steps. Here’s how your can disable Ctrl + U of your site-

Note: If you disable Ctrl+U of your page, people will still be able to view your page source if you don’t disable your right click as well. Click here to see how you can disable right click of your website.

To disable Ctrl+U, you just need to place the below script above the closing </head> tag.


<script type="text/javascript">
document.onkeydown = function (cc) {
if(cc.which == 85){
return false;
}
if(cc.which == 80){
return false;
}
}
</script>

That’s all you need to do to disable viewing of your page source using shortcut keys. But to disable Ctrl+P along with Ctrl+U, use the below script instead. 

<script type="text/javascript">
document.onkeydown = function (cc) {
if(cc.which == 85){
return false;
}
}
</script>

 The script actually disables just the ‘U’ and ‘P’ button which is all we need. Users will still be able to use other shortcut keys like ‘Ctrl C’ and ‘Ctrl A’. If you came here looking for some script to disable viewing page source because that’s how your contents are getting copied. Then you must disable other functions too, like content selection and all.

When you see that your contents are getting copied, don’t panic! Fight it. Here are the list of things you can do-

Disable content selection.
Disable right click.
Disable some specific keys like I have showed you on this one.
And the best thing you can do is file a complain to Google. Use this form to complain about the copied content. If the owner is using Google’s blogger, then they will surely take some serious action. If they find you right, then Google will either delete the content, or the entire blog or simply remove the copied content from the search results.
Share this article :

Post a Comment

 
Support :
Copyright © 2016. NEEL COM

powered by Blogger