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

315
Visualizações
window.open() reference is having closed true, after perform submit in child window without closing child in chrome only

when i open child window and search something in search box and when see the 'child.closed' status giving different results in Firefox and Chrome. Please help to get the same status in both browsers. Firefox: 'child.closed' returns false Chrome: 'child.closed' returns true

<html lang="en">

<head>
    <title>Sample page</title>
    <script>
        function openChild() {
            var child = window.open('http://google.com', 'auditor_child_tab', 'location=yes,status=yes,width=1366,height=768');
            const clearTimeout = setInterval(() => {
                if (child && child.closed) {
                    clearInterval(clearTimeout)
                    console.log("THE CHILD WINDOW HAS BEEN CLOSED")
                } else {
                    console.log("OK")
                }
            }, 1000)
        }
    </script>
</head>

<body>
    <h1>Sample Page</h1>
    <button onclick="openChild()">Open Child</button>
</body>

</html>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

window.closed property should be giving the same response in both browsers. This is the standard way to check window is still opened. I see one problem in your code. You should also check whether the window object is null or not.

function openChild() {
            var child = window.open('http://google.com', 'auditor_child_tab', 'location=yes,status=yes,width=1366,height=768');
            const clearTimeout = setInterval(() => {
                if (child === null || child.closed) {
                    clearInterval(clearTimeout)
                    console.log("THE CHILD WINDOW HAS BEEN CLOSED")
                } else {
                    console.log("OK")
                }
            }, 1000)
        }

Regards, omi

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