Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. exit button

exit button

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
25 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zaimah
    wrote on last edited by
    #1

    how to create exit button? meaning close the window.

    C W 2 Replies Last reply
    0
    • Z zaimah

      how to create exit button? meaning close the window.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      window.close() I guess. That's javascript, of course.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      S 1 Reply Last reply
      0
      • C Christian Graus

        window.close() I guess. That's javascript, of course.

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        S Offline
        S Offline
        Sonia Gupta
        wrote on last edited by
        #3

        Is there any way to close the window without alerting the user?.

        Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.

        C N 2 Replies Last reply
        0
        • S Sonia Gupta

          Is there any way to close the window without alerting the user?.

          Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          No - the web is not a friendly enough place for browsers to allow that sort of thing.

          Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          Z S 2 Replies Last reply
          0
          • S Sonia Gupta

            Is there any way to close the window without alerting the user?.

            Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.

            N Offline
            N Offline
            N a v a n e e t h
            wrote on last edited by
            #5

            If the window is opened by a JS, it is possible.

            All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

            Z S 2 Replies Last reply
            0
            • C Christian Graus

              No - the web is not a friendly enough place for browsers to allow that sort of thing.

              Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

              Z Offline
              Z Offline
              zaimah
              wrote on last edited by
              #6

              how can i use it in asp.net? sorry to disturb u again..

              N 1 Reply Last reply
              0
              • Z zaimah

                how can i use it in asp.net? sorry to disturb u again..

                N Offline
                N Offline
                N a v a n e e t h
                wrote on last edited by
                #7

                It has nothing to do with ASP.NET. It's just javascript.

                All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

                1 Reply Last reply
                0
                • N N a v a n e e t h

                  If the window is opened by a JS, it is possible.

                  All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

                  Z Offline
                  Z Offline
                  zaimah
                  wrote on last edited by
                  #8

                  what is JS? i try to use Response.Close() but this page appear "Internet Explorer cannot display the webpage".

                  N 1 Reply Last reply
                  0
                  • Z zaimah

                    what is JS? i try to use Response.Close() but this page appear "Internet Explorer cannot display the webpage".

                    N Offline
                    N Offline
                    N a v a n e e t h
                    wrote on last edited by
                    #9

                    zaimah wrote:

                    what is JS

                    JS is Java Script

                    zaimah wrote:

                    Response.Close()

                    Looks like you are not aware of how an ASP.NET page works. Response.Close() closes the connection to the client, not browser window. This executes on the sever. Java scipt executes on the client machine. To close a window from ASP.NET, you need to emit JS to the response.

                    All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

                    Z 1 Reply Last reply
                    0
                    • N N a v a n e e t h

                      zaimah wrote:

                      what is JS

                      JS is Java Script

                      zaimah wrote:

                      Response.Close()

                      Looks like you are not aware of how an ASP.NET page works. Response.Close() closes the connection to the client, not browser window. This executes on the sever. Java scipt executes on the client machine. To close a window from ASP.NET, you need to emit JS to the response.

                      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

                      Z Offline
                      Z Offline
                      zaimah
                      wrote on last edited by
                      #10

                      yup, i'm not familliar with ASP.Net, just started a month ago. but i try to use window.close() as suggested, but there's a msg stated "windos not declared". why is it? sorry my english not so good.

                      N 1 Reply Last reply
                      0
                      • Z zaimah

                        yup, i'm not familliar with ASP.Net, just started a month ago. but i try to use window.close() as suggested, but there's a msg stated "windos not declared". why is it? sorry my english not so good.

                        N Offline
                        N Offline
                        N a v a n e e t h
                        wrote on last edited by
                        #11

                        <script language="javascript">
                        function closeWindow(){
                        window.close();
                        }
                        </script>

                        I guess you wrote it on the code behind. Write it in the ASPX page inside head section. Call this from the control to close window.

                        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

                        S 1 Reply Last reply
                        0
                        • N N a v a n e e t h

                          <script language="javascript">
                          function closeWindow(){
                          window.close();
                          }
                          </script>

                          I guess you wrote it on the code behind. Write it in the ASPX page inside head section. Call this from the control to close window.

                          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

                          S Offline
                          S Offline
                          Syed Ali Raza
                          wrote on last edited by
                          #12

                          use this line on your exit button click event. Response.Write("<script language='javascript'> { self.close() }</script>");

                          1 Reply Last reply
                          0
                          • C Christian Graus

                            No - the web is not a friendly enough place for browsers to allow that sort of thing.

                            Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                            S Offline
                            S Offline
                            Sonia Gupta
                            wrote on last edited by
                            #13

                            u might have heard about the monster.com website , there , the moment u update ur resume , there u can close the window by the button click , and without noticing the user !!!!!!

                            Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.

                            modified on Wednesday, March 5, 2008 2:35 AM

                            V 1 Reply Last reply
                            0
                            • N N a v a n e e t h

                              If the window is opened by a JS, it is possible.

                              All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

                              S Offline
                              S Offline
                              Sonia Gupta
                              wrote on last edited by
                              #14

                              u might have heard about the monster.com website , there , the moment u update ur resume , there u can close the window by the button click , and without noticing the user !

                              Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.

                              modified on Wednesday, March 5, 2008 2:35 AM

                              Z 1 Reply Last reply
                              0
                              • S Sonia Gupta

                                u might have heard about the monster.com website , there , the moment u update ur resume , there u can close the window by the button click , and without noticing the user !

                                Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.

                                modified on Wednesday, March 5, 2008 2:35 AM

                                Z Offline
                                Z Offline
                                zaimah
                                wrote on last edited by
                                #15

                                that would be good. but how did they do it?

                                S 1 Reply Last reply
                                0
                                • S Sonia Gupta

                                  u might have heard about the monster.com website , there , the moment u update ur resume , there u can close the window by the button click , and without noticing the user !!!!!!

                                  Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.

                                  modified on Wednesday, March 5, 2008 2:35 AM

                                  V Offline
                                  V Offline
                                  Vasudevan Deepak Kumar
                                  wrote on last edited by
                                  #16

                                  If your script had opened a window, you have the rights to close it through window.close() without requesting permissions from the user. Otherwise, the web browser is obliged to get a nod from the user whether to accede to your request.

                                  Vasudevan Deepak Kumar Personal Homepage
                                  Tech Gossips
                                  A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

                                  S 1 Reply Last reply
                                  0
                                  • Z zaimah

                                    that would be good. but how did they do it?

                                    S Offline
                                    S Offline
                                    Sonia Gupta
                                    wrote on last edited by
                                    #17

                                    i am also looking the same.:)

                                    Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.

                                    Z N 2 Replies Last reply
                                    0
                                    • V Vasudevan Deepak Kumar

                                      If your script had opened a window, you have the rights to close it through window.close() without requesting permissions from the user. Otherwise, the web browser is obliged to get a nod from the user whether to accede to your request.

                                      Vasudevan Deepak Kumar Personal Homepage
                                      Tech Gossips
                                      A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

                                      S Offline
                                      S Offline
                                      Sonia Gupta
                                      wrote on last edited by
                                      #18

                                      can u elaborate this process of closing the window without user permissions?

                                      Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.

                                      _ 1 Reply Last reply
                                      0
                                      • S Sonia Gupta

                                        i am also looking the same.:)

                                        Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.

                                        Z Offline
                                        Z Offline
                                        zaimah
                                        wrote on last edited by
                                        #19

                                        if u do find the answer pls tell me.. :) it's much easier without the msg..

                                        1 Reply Last reply
                                        0
                                        • S Sonia Gupta

                                          can u elaborate this process of closing the window without user permissions?

                                          Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.

                                          _ Offline
                                          _ Offline
                                          _AK_
                                          wrote on last edited by
                                          #20

                                          What he is trying to tell is if the window has been opened through Javascript then you will not be asked for the permission otherwise confirmation box will appear.

                                          Apurva Kaushal

                                          S 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups