0

I want to disable the ctrl key in the IE browser.I had tried some solution using javascript but nothing is working can someone please help me to find out the solution

document.onkeydown = function () { 
  if (event.keyCode == 17) alert('Ctrl Key is disabled'); 
};


document.onkeydown = function(e) {
         if (e.altKey && (e.keyCode === 36)) {//Alt+home blocked.
            return false;
        }
        if (e.altKey && (e.keyCode === 70)) {//Alt+f blocked.
            return false;
        }
    };


function hookKeyboardEvents(e) {
    // get key code
    var key_code = (window.event) ? event.keyCode : e.which;

    // case :if it is IE event
    if (window.event)
    {
        if (!event.shiftKey && !event.ctrlKey) {
            window.event.returnValue = null;
            event.keyCode = 0;
        }
    }
    // case: if it is firefox event
    else
        e.preventDefault();
}

window.document.onkeydown = hookKeyboardEvents;
Chilll007
  • 589
  • 1
  • 4
  • 20
  • http://stackoverflow.com/questions/16280582/how-can-i-disable-the-ctrl-a-using-javascript –  Feb 11 '16 at 10:25

1 Answers1

0

function Disable_Control_C() {
var keystroke = String.fromCharCode(event.keyCode).toLowerCase();

if (event.ctrlKey && (keystroke == 'c' || keystroke == 'v' || keystroke == 'p' || keystroke == 's' || keystroke == 'u')) {
alert("this function is disabled");
event.returnValue = false; // disable Ctrl+C
}
}
<body onkeydown="javascript:Disable_Control_C()">

this is what i do it to run in the IE...

Chilll007
  • 589
  • 1
  • 4
  • 20