LightBlog

Post Top Ad

LightBlog
LightBlog

19/06/2017

How to Disable CTRL+U, CTRL+C and Mouse Right Click on a Webpage or Your Website/Blog

You'll use a stronger Javascript code that not disable selection of text solely, however additionally it would disable  CTRL + U: Can be used to see actual HTML code, used to produce a Webpage
CTRL+C: Can be Used to Copy Highlighted / Selected text.

Right Mouse Click: Displays list of Options to try and do Something with the Item such as view source, copy, paste etc. on your Blog or Website.

OK, Let"s move to the tutorial of disabling CTRL+U , CTRL+C  and Mouse Right Click on your web-site or Blog.

You can use any one code from here to get your favorite.

1. Disable only CTRL+U 

Enable CTRL+C & Mouse Right Cilck.

In your Site or Blog Edit HTML, search for </head> tag, Just above it paste below javascript code.
<script type='text/javascript'>
var isCtrl = false;
document.onkeyup=function(e)
{
if(e.which == 17)
isCtrl=false;
}
document.onkeydown=function(e)
{
if(e.which == 17)
isCtrl=false;
if((e.which == 85) || (e.which == 67) &amp;&amp; isCtrl == true)
{
// alert(&#8216;Keyboard shortcuts are cool!&#8217;);
return false;
}
}
var isNS = (navigator.appName == &quot;Netscape&quot;) ? 1 : 0;
if(navigator.appName == &quot;Netscape&quot;) document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
return false;
}

</script>


2. Disable CTRL+U & CTRL+C

Enable Mouse Right Click
In your Site or Blog Edit HTML, search for </head> tag, Just above it paste below javascript code.
<script type='text/javascript'>
var isCtrl = false;
document.onkeyup=function(e)
{
if(e.which == 17)
isCtrl=false;
}
document.onkeydown=function(e)
{
if(e.which == 17)
isCtrl=true;
if((e.which == 85) || (e.which == 67) &amp;&amp; isCtrl == true)
{
// alert(&#8216;Keyboard shortcuts are cool!&#8217;);
return false;
}
}
var isNS = (navigator.appName == &quot;Netscape&quot;) ? 1 : 0;
if(navigator.appName == &quot;Netscape&quot;) document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
return false;
}
</script>

3. Disable CTRL+U,CTRL+C and Mouse Right Click

Disable All Shortcut key or Click.
In your Site or Blog Edit HTML, search for </head> tag, Just above it paste below javascript code.
<script type='text/javascript'>
var isCtrl = false;
document.onkeyup=function(e)
{
if(e.which == 17)
isCtrl=false;
}
document.onkeydown=function(e)
{
if(e.which == 17)
isCtrl=true;
if((e.which == 85) || (e.which == 67) &amp;&amp; isCtrl == true)
{
// alert(&#8216;Keyboard shortcuts are cool!&#8217;);
return false;
}
}
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
return false;
}
function mousehandler(e){
var myevent = (isNS) ? e : event;
var eventbutton = (isNS) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
</script>

Now Save the Changes & You are Done !

Thanks for see the post. Good Bye.

5 comments:

  1. Thanks it works like magic and i love it. I love the implementation on www.healthcentera.com. It was easy and fast. Just bookmark yur site for other things

    ReplyDelete
  2. Nice article, love to read your blog, thanks to sharing this beautiful blog with us (Autonomous Communication)

    ReplyDelete
  3. Thanks it works like magic and i love it. I love the implementation on www.ibusinessngr.info It was easy and fast. Just bookmark yur site for other things

    ReplyDelete
  4. I so much love this www.iworkngr.info. I use it to disable all the ctrl

    ReplyDelete
  5. The best Set up your remote video stream for redundancy with the compact Q Series 4G / 5G
    Live Streaming Bonding Video Encoder from Mine Media Q8.
    buy the best news channel setup Plan at the best price.

    ReplyDelete

LightBlog

We’ll never share your email address with a third-party.

Labels

Labels

Labels