Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

310
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!