Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

286
Visualizações
IE doesn't detect Prt Scn key's keyup event (keyCode: 44) before other keyup event fire

Here's my code

$(document).on("keyup", function(e) {
    console.log(e.key);
    if (e.key == "PrintScreen") {
        e.preventDefault();
        clearClipBoard();
    }
})

function clearClipBoard() {
    if (navigator.clipboard) { // Chrome or Edge
        navigator.clipboard.writeText(""); 
    }
    else if (window.clipboardData) { // Internet Explorer
        window.clipboardData.setData("Text", "");
    }
}

When the page loaded first time, or blur and focus back again, the keyup event of PrintScreen cannot be detected. But if I press other key first and then press the Prt Scn key, it can be detected successfully.

It only happens when using IE, when I using Chrome or Edge, it doesn't have this problem.

I've tried to trigger a keyup event of other key when the page focus back, but the Prt Scn key still cannot be detected.

$(window).on("focus", function() {
    $.alert("focus");
    let e = $.Event('keyup');
    e.key = 'a'; 
    $("body").trigger(e);
})

I found someome has the same question but no answer. IE 11 Print screen issue

Any one have any ideas what might be causing this issue?

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda