Javascript IE中的PrtScn按钮与使用java脚本的其他浏览器不同

Javascript IE中的PrtScn按钮与使用java脚本的其他浏览器不同,javascript,jquery,internet-explorer,Javascript,Jquery,Internet Explorer,我一直在使用下面的javascript代码来阻止普通用户(当然不是专业人士)在浏览器上使用print screen&Ctrl+A&Ctrl+C。 它在Firefox和Chrome上确实可以正常工作,但有时在IE上可以正常工作,有时会失败。请检查代码,如果你可以一点帮助,也许是什么错了IE。为什么它失败了 function disableselect(e) { return false; } function reEnable() { return true; } document

我一直在使用下面的javascript代码来阻止普通用户(当然不是专业人士)在浏览器上使用print screen&Ctrl+A&Ctrl+C。 它在Firefox和Chrome上确实可以正常工作,但有时在IE上可以正常工作,有时会失败。请检查代码,如果你可以一点帮助,也许是什么错了IE。为什么它失败了

function disableselect(e) {
    return false;
}
function reEnable() {
    return true;
}
document.onselectstart = new Function("return false");
if (window.sidebar) {
    document.onmousedown = disableselect;
    document.onclick = reEnable;
}
function copyToClipboard() {
  // Create a "hidden" input
  var aux = document.createElement("input");
  // Assign it the value of the specified element
  aux.setAttribute("value", "You can no longer give print-screen. This is part of the new system security measure");
  // Append it to the body
  document.body.appendChild(aux);
  // Highlight its content
  aux.select();
  // Copy the highlighted text
  document.execCommand("copy");
  // Remove it from the body
  document.body.removeChild(aux);
  alert("You can no longer give print-screen. This is part of the new system security measure.");
}
$(window).keyup(function(e){
  if(e.keyCode == 44){
    copyToClipboard();
  }
}); 
$(window).focus(function() {
  $("body").show();
}).blur(function() {
  $("body").hide();
});

我已经用Chrome、Firefox和IE11对它进行了测试


但是,如果有人使用Inspect元素禁用CSS限制,那么他将禁用它:)

要获得更快、更好的回复,请指定您针对IE v测试的IE版本。我使用的是is IE 11,但我希望它能与尽可能多的版本一起工作。我知道在网站上这样做很烦人,但这正是客户想要的行为!非常感谢@ControlAltDel的帮助,我已经尝试使用一些模拟代码来触发一个伪键,这样它就可以通过窗口加载来加载,但是我没有成功,下面是js fiddle上的代码。如果有人不使用任何键就在IE上按print screen,在他能够毫无问题地打印屏幕之前,任何帮助都将被感激:)有很多方法可以真正打破它。这只是一个象征性的代码,用来限制孩子们在学校里互相传递信息。