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 501637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:12:36+00:00 2026-05-13T06:12:36+00:00

How can i close all the IE browser window in asp.net, I am opening

  • 0

How can i close all the IE browser window in asp.net,

I am opening many windows..from javascript by window.open()…
I need to close all the windows by clicking the button in main page(parent window).

some times we have open in in c# it self

btnShow.Attributes.Add("onclick", @"var windowVar=window.open('" + sAppPath + @"', 'parent');windowVar.focus(); return false;");

at the time how can i put in array in javascript.

How can i do it?

  • 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-05-13T06:12:37+00:00Added an answer on May 13, 2026 at 6:12 am

    Concept

    Whenever you open a window from the main page, keep a reference to the opened window (pushing it onto an array works well). When the main page button is clicked, close each referenced window.

    Client Script

    This JavaScript is for the main page. This works for an HTML or ASPX page.

    var arrWindowRefs = [];
    //... assume many references are added to this array - as each window is open...
    
    //Close them all by calling this function.
    function CloseSpawnedWindows() {
       for (var idx in arrWindowRefs)
          arrWindowRefs[idx].close();
    }
    

    Opening a window and pushing it onto the above array looks something like this:

    // Spawn a child window and keep its reference.
    var handle = window.open('about:blank');
    arrWindowRefs.push(handle);
    

    Microsoft’s JavaScript window.open(..) method and its arguments are outlined here.

    Different browsers might have variations or proprietary ways to keep references to opened windows or to enumerate through them, but this pure JavaScript way is very compatible with browsers.

    Button

    Finally the HTML Input button to initiate the above code would be

    <input type="button" 
        name="btn1" id="btn1" value="Click Me To Close All Windows"
        onclick="CloseSpawnedWindows()">
    

    If it’s an ASP.NET Button Control then call JavaScript this way

    <asp:Button ID="Button1" runat="server" Text="Click Me To Close All Windows" 
            OnClientClick="CloseSpawnedWindows()" />
    

    Troubleshooting ASP.NET client script (PostBack and AJAX fix)

    If your aspx page posts back to the server, the client code will be destroyed and lose it’s array with child window references (and those windows will remain open). If this is a concern, you might want to use AJAX for partial page refreshes, to prevent the entire page and its scripts from being destroyed.

    (Shown using Framework 3.5 samples)

    For ASP.NET AJAX you’ll be using something like a ScriptManager instance to enable partial page refresh inside UpdatePanel controls (lots of samples).

    <%@Page... %>
    
    <asp:ScriptManager EnablePartialRendering="True" /> Enable AJAX.
    
    <script>
    // PUT JAVASCRIPT OUT HERE SOMEWHERE.
    // Notice the client script here is outside the UpdatePanel controls,
    //  to prevent script from being destroyed by AJAX panel refresh.
    </script>
    
    <asp:UpdatePanel ID="area1" runat="server" ... > ... </asp:UpdatePanel>
    <asp:UpdatePanel ID="area2" runat="server" ... > ... </asp:UpdatePanel>
    etc...
    

    A lot more detail about ASP.NET AJAX can be provided but this is just a start in case you need it.

    Remember, in the case of AJAX, don’t refresh the part of the page containing the above Client Script because you want it to persist the array through server callbacks.

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

Sidebar

Related Questions

How can I use Cache in ASP.NET which is accessible by all users not
how can I make this jquery script close all previously opened children when entering
Edit: We can close. Isn't truly asynchronous, non-blocking javascript impossible? var PATH = require
I'm trying to open video player in windows 7 with PHP but can't seem
Suppose user has opened my web application in many different browser windows. After sometime
How can I close any Office 2007 running application like Word,Excel,Outlook before installing an
Just for fun, how close can we get to debug an application in C#
When a UIDocument is closed, can it close again? Even when it's documentState is
How i can show a close button after certain elapsed, i tried settimeout but
I've an application that you can show and close several Dialogs with: showDialog(...) removeDialog(...)

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.