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

  • SEARCH
  • Home
  • 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 8068675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:46:06+00:00 2026-06-05T12:46:06+00:00

I have an C# aspx web application that opens a popup window with JavaScript.

  • 0

I have an C# aspx web application that opens a popup window with JavaScript. I capture the window handle and put that value into an array. When the web application closes, I want to close the popup window. When I interrogate the array, the window handle is no longer in the array, so I can’t find the window to close it. This behavior is strange to me, since other popup windows (that don’t contain silverlight) will remain in the array, and are closed when the application ends.

At first, I thought it was something that could be solved with a frame, like popup windows containing PDFs not being able to be closed, but the solution for that didn’t work here for me. This was something I had to use with PDFs

Question: How do I close the popup window containing Silverlight when the aspx main window closes?

Some JavaScript code:

var openedWindows = new Array();
function OpenNamedWindow(url, name, features, replace)
{
    var oWin = open(url, name, features, replace);
    // The Silverlight window object is within this array afterwards, and in subsequent calls
    // to this method
    openedWindows.push(oWin);
}

function CloseOpenedWindows()
{
    while (openedWindows.length > 0)
    {
        var window = openedWindows.shift();
        if(!window.closed)
            window.close();
    }
}

The Main aspx form (abbreviated)

<html>
  <body onunload="CloseOpenedWindows();"> ... <body/>
</html>
  • 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-05T12:46:07+00:00Added an answer on June 5, 2026 at 12:46 pm

    Turns out that the javascript file that contained the

    var openedWindows = new Array();
    

    was being loaded multiple times, so javascript got confused as to which array it needed to iterate through. Ensuring that the js file was only loaded once solved the problem.

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

Sidebar

Related Questions

In my web application I have a master aspx page in that i have
I have a web application based on vb.net I used MsgBox() in my MYPage.aspx.vb
I have a web page (.aspx) that calls a third party web service to
I currently have a web form aspx page that calls RegisterClientScriptBlock. This sends down
I have an web application that I'm working on, it was working fine until
I have a Web Application that I received from another developer, when I first
We have a web application that displays a variety of document types to the
I have web application in that I have a ajaxTabedinterface. I want open the
We have an application that produces HTML documents which the user opens in word
I have an ASP.NET Web Application that constantly monitors for new RSS Feed from

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.