Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8864959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:23:06+00:00 2026-06-14T16:23:06+00:00

If I have created a popup window using newWindow = window.open(url, name, dimensions) ,

  • 0

If I have created a popup window using newWindow = window.open(url, name, dimensions), how can I check whether the window is closed in a way that will work on mobile browsers?

I tried using if(newWindow.closed), and this works in Chrome on a PC and works on iPhone. However, on the Android phones I have tested on, this doesn’t work; the popup closes but newWindow.closed is not true. What test should I use instead that will work on any platform to check if a popup is closed?

Extra info:
I used jsconsole to log newWindow (with console.log(newWindow)) before and after the popup was closed when visiting my page on an Android phone. While the popup window is open, it shows up in the console as [object DOMWindow], and once the window is closed console.log(newWindow) just prints a blank line to the jsconsole. Note that printing a blank line is distinct from how jsconsole displays null, undefined or false, which show up exactly as I just typed them. Furthermore, trying if(newWindow.closed || !newWindow) works no better than just if(newWindow.closed) did; it seems that whatever kind of object newWindow becomes after the popup is closed, it is still truthy.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:23:08+00:00Added an answer on June 14, 2026 at 4:23 pm

    Checking if(newWindow.closed != false) instead of if(newWindow.closed) solved my problem and works on all platforms I have tested on. The cause of the issue appears to be that on some Android phones, the value of newWindow.closed ends up being undefined instead of true when the popup window is closed. newWindow.closed is reliably set to false while the window is open, though, whatever platform you’re on.

    Some relevant discussion that potentially explains the reasons behind this bug can be found here (although I can’t confirm its veracity):
    http://code.google.com/p/android/issues/detail?id=21061

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have created a popup window using the following code in javascript; window.open(http://google.com, myWindow,
I created a new popup window from an existing page using: window.open(myUrl,myName,width=200,height=200); Now on
I am new to android development. I have created a popup window which is
I am using facebox to get some information in a popup window. I have
I have a popup window that must span multiple frames, so I'm using window.createPopup
I have some jQuery that I'm using to open a pop-up window where a
I have created some JQuery that will expand a div 'popup' on hover and
I have created an Activity that will behave like a popup menu is actually
Is there a way to programmatically instruct IE8 to open a popup in a
I have to open an html form in a popup. Popup should not be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.