How to close browser?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: How to close browser?

  1. #1
    d_danturthi@hotmail.com Guest

    How to close browser?


    I have an ASP.NET with C# application and want to close browser window with
    click of a button (or link). One can do this with

    Response.Write("<script>window.close()</script>");

    But this does NOT work if the smartnavigation property of the webform is
    set to TRUE.

    Does anyone know how to close a browser window in C# with ASP.NET? Please
    do NOT suggest java scripting/cookie etc. There must be no cookies attached
    and all code is server side. Yeah, it is bad idea but let it go that way
    for now. Thanks in advance.
    SD

  2. #2
    David Rothgery Guest

    Re: How to close browser?


    "d_danturthi@hotmail.com" <vb.@127.0.0.1> wrote in message
    news:3ece9f16$1@tnews.web.devx.com...
    >
    > I have an ASP.NET with C# application and want to close browser window

    with
    > click of a button (or link). One can do this with
    >
    > Response.Write("<script>window.close()</script>");
    >
    > But this does NOT work if the smartnavigation property of the webform is
    > set to TRUE.
    >
    > Does anyone know how to close a browser window in C# with ASP.NET? Please
    > do NOT suggest java scripting/cookie etc. There must be no cookies

    attached
    > and all code is server side. Yeah, it is bad idea but let it go that way
    > for now. Thanks in advance.


    It's not possible without client-side script (like your first try uses). How
    can code that runs on your server tell a user's web browser what to do? All
    your C#/ASP.NET code does is produce HTML, CSS, and JavaScript; IE doesn't
    understand C#.

    FYI - current versions of IE will ask for confirmation if you try to close
    the browser window from script.

    --
    Dave Rothgery
    drothgery@alum.wpi.edu



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center