1

I am unable to overwrite ctrl+p in IE-11. Please Suggest something. I already tried from below code snippet .But, Its not working

Code to prevent default action

document.onkeydown = function(event) {

        event.cancelBubble = true; 
        event.returnValue = false; 
        event.keyCode = 0;
        event.stopPropagation();
        event.preventDefault();
           return false;
    }

Its working in compatibility mode on. When compatibility mode is off , then its not working . Please suggest solutions of it.

  • 3
    Don't mess with a browser's native functionality. – Cerbrus Sep 10 '14 at 14:18
  • possible duplicate of [How to listen for Ctrl-P key press in JavaScript?](http://stackoverflow.com/questions/12517819/how-to-listen-for-ctrl-p-key-press-in-javascript) – karthikr Sep 10 '14 at 14:18
  • it seems IE11 doesn't allow developers to disable default behavior of certain native key bindings. there is a similar thread about Ctrl+O http://stackoverflow.com/questions/22083984/can-not-disable-ctrlo-by-javascript-in-ie-11 – tommyTheHitMan Nov 05 '14 at 15:17

1 Answers1

0

try,

 if(e.ctrlKey && e.keyCode == 80){
    return false;
}
BReal14
  • 1,603
  • 1
  • 12
  • 35