Disable Ctrl+C, Ctrl+V and right click on your webpage:

Disable Ctrl+C, Ctrl+V and right click:

Security is one of the most valuable, teasing and challenging task for globe in all the domain of life.  Even when you create webpage, blog or create stunning, creative web form. Often, It has been observed from the visitor of the website, they try to see the code behind the page, copy the content from page also press Ctrl+V to look code separately  in the webpage with separate tab.

In both style of website (static or dynamic) JavaScript play a vital role in website, using JavaScript we can create creative kind of work on website.  A developer write code with very hard work according to the market or client demand and visitor can copy or see the behind code easily which is not fair. To prevent the code including HTML, CSS AND JAVASCRIPT on you page, you can write the below code using JavaScript to prevent the user to use  Ctrl+C, Ctrl+V and right click on your webpage:


      Just use this code in the head section of your code and feel the changes in the webpage also save the code then run into the browser!

<script type='text/javascript'>
var Controller = false;
document.onkeyup=function(e)
{
if(e.which == 17)
Controller =false;
}
document.onkeydown=function(e)
{
if(e.which == 17)
Controller =true;
if((e.which == 85) || (e.which == 67) &amp;&amp; Controller == true)
{
return false;
}
}
var NS = (navigator.appName == "Netscape") ? 1 : 0;
if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
return false;
}
function mousehandler(e){
var eventt = (NS) ? e : event;
var ebutton = (isNS) ? eventt.which : eventt.button;
if((ebutton ==2)||( ebutton ==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
</script>

         For easiest and creative way to learn latest computer, web application concept follow the blog and website of mine.


No comments:

Post a Comment

Fell free to write your query in comment. Your Comments will be fully encouraged.