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

219
Visualizações
Bind key to open a specific website on my website

I'm creating a website for my school about a certain topic. I thought it would be fun if I put a little "secret" where I can press a button that will open a secret page or overlay...

Example of a website that uses something like this: https://krunker.io/ (press the number "5" when in main menu)

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

It is quite simple, you can add some event listener to the body like this.

body = document.querySelector("body")
body.addEventListener("keyup", (event) => {
    console.log(event)
})

Then, if you see the event variable. You'll see what key you've been pressed when you are on the page. Once you understand, you can customize the function to reach what you desire. For example, if "w" is pressed :

body.addEventListener("keyup", (event) => {
    if(event.key === "w"){
      // Do something here
    }
})
about 4 years ago · Juan Pablo Isaza Relatório

0

Hi you can bind to a your website with something like this

document.addEventListener("keydown", (event) => {
  // Move this to a separate function to manage the logic
  if (event.code === "Numpad9") {
    console.log("Numpad9 Pressed");
  }

  // Your page here
  window.open("www.youtube.com", "_blank");
});
about 4 years ago · Juan Pablo Isaza Relatório
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