ASP.NET - window.close()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gene Brumm

    ASP.NET - window.close()

    I have an ASP.NET web application that checks for a
    database in Page_Load(). If the database is not present I
    want to exit the application.

    I have tried using window.close() which does close the
    app but prompts the user if he/she wants to close the
    browser. I don't want the prompt since the app must close.

    How can I do this?
  • Nicholas Then

    #2
    ASP.NET - window.close()

    I have tried this, and I get the same thing. From what I
    have been told and have read, it is a security feature
    that is built into the browser itself. I do not think it
    can be overridden, or that would make the security on the
    browsers kinda useless. The only way that I know of how
    to have a window automatically close is when the parent
    page opens a popup window. Then the popup window can
    close without prompts, but I believe the parent window
    will always have prompts.

    Comment

    • Cowboy \(Gregory A. Beamer\)

      #3
      Re: ASP.NET - window.close()

      You can stop a person from using your app, but you cannot shut down their
      browser without their permission. I would aim for logic that sends them to a
      "this app is not working because there is no database" friendly error page.

      --
      Gregory A. Beamer
      MVP; MCP: +I, SE, SD, DBA

      *************** *************** *************** *************** **********
      Think Outside the Box!
      *************** *************** *************** *************** **********
      "Gene Brumm" <Gene.Brumm@Tho mson.com> wrote in message
      news:0ae101c3b8 33$87233420$a50 1280a@phx.gbl.. .[color=blue]
      > I have an ASP.NET web application that checks for a
      > database in Page_Load(). If the database is not present I
      > want to exit the application.
      >
      > I have tried using window.close() which does close the
      > app but prompts the user if he/she wants to close the
      > browser. I don't want the prompt since the app must close.
      >
      > How can I do this?[/color]


      Comment

      • Michael Giagnocavo [MVP]

        #4
        Re: ASP.NET - window.close()

        Exactly right. At any rate, you'd want to notify the user most likely. So,
        you could show a little page that does a window alert (to tell them that the
        db isn't available, please close the window), writes some text to the page
        (if they don't close the page).
        -mike
        MVP

        "Nicholas Then" <nick@unitedagy .com> wrote in message
        news:011e01c3b8 3a$ab309e50$a40 1280a@phx.gbl.. .[color=blue]
        > I have tried this, and I get the same thing. From what I
        > have been told and have read, it is a security feature
        > that is built into the browser itself. I do not think it
        > can be overridden, or that would make the security on the
        > browsers kinda useless. The only way that I know of how
        > to have a window automatically close is when the parent
        > page opens a popup window. Then the popup window can
        > close without prompts, but I believe the parent window
        > will always have prompts.[/color]


        Comment

        Working...