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

209
Visualizações
hi, it is possible to detect on react that the page is rendering by a ctrl+shift+t command?

it is possible to detect on react that the page is rendering by a ctrl+shift+t command ? for example, i need to detect this situation:

  1. The user closes the browser tab
  2. Then the user press ctrl+shift+t to re-open the tab
  3. I then identify that the tab was opened from a ctrl+shift+t command

Is this possible ? How ?

Update: I have this piece of code on my page:

    useEffect(() => {
    function handleResize() {
        //some stuff
    }
    window.addEventListener('popstate', handleResize);

    return function cleanupListener() {
      console.log('backing')
     
      window.removeEventListener('popstate', handleResize);
    };
  }, []);

When i click to go to this page, i make a history.push(/chat). Then if i click on back button the console.log 'backing' is shown. But if i close the tab and re-open, if i click on back button, the console.log doesn't show :/

Thanks in advance

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

0

It's not possible because you cannot get the user key press events when it's out of focus from the dom.

But you can prevent or warn user from closing the tab,

window.addEventListener('beforeunload', function (e) {
            e.preventDefault();
            e.returnValue = '';
        });
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