"OnClose" window event

Discussion in 'HTML' started by Kamyk, Mar 1, 2005.

  1. Kamyk

    Kamyk Guest

    Hello all!

    I know that in HTML there is no such event, but is it possible to make event
    on close a window. If so, please write me example how to do it.

    Thank you in advance
    Marcin from Poland
    Kamyk, Mar 1, 2005
    #1
    1. Advertising

  2. Kamyk

    Steve Pugh Guest

    "Kamyk" <> wrote:

    >I know that in HTML there is no such event, but is it possible to make event
    >on close a window. If so, please write me example how to do it.


    What do you want to do and why? If we know more details we may be able
    to suggest alternatives.

    There's onUnload but that get's triggered when a link is followed and
    as it's often misused for nefarious purposes I believe some browsers
    are starting to give users the ability to switch it off.

    If the window in question was created by another window the the
    creating window can check for the existance of the created window.
    Hence you could run a check periodically, or whenever the creating
    window recieves focus and perform an action then if the created window
    no longer exists. Of course that's no good if the creating window is
    closed first.

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
    Steve Pugh, Mar 1, 2005
    #2
    1. Advertising

  3. Kamyk

    Kamyk Guest

    > >I know that in HTML there is no such event, but is it possible to make
    event
    > >on close a window. If so, please write me example how to do it.

    >

    I want to delete one value from one column from the database using a SQL
    query
    after clicking "x" on the window. So how to link it with a event. Is it
    possible?

    Marcin from Poland
    Kamyk, Mar 1, 2005
    #3
  4. Kamyk

    Adrienne Guest

    Gazing into my crystal ball I observed "Kamyk"
    <> writing in news:d02jf7$59c$1
    @news.onet.pl:

    >> >I know that in HTML there is no such event, but is it possible to

    make
    >> >event on close a window. If so, please write me example how to do it.

    >>

    > I want to delete one value from one column from the database using a

    SQL
    > query
    > after clicking "x" on the window. So how to link it with a event. Is it
    > possible?
    >
    > Marcin from Poland
    >
    >
    >


    That's very BAD idea. If there is no javascript available, you will not
    have an event. If you do have javascript, and the window is not closed,
    how is your script going to fire? You need to rethink your application.

    --
    Adrienne Boswell
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
    Adrienne, Mar 1, 2005
    #4
  5. Kamyk wrote:

    > I want to delete one value from one column from the database using a SQL
    > query after clicking "x" on the window. So how to link it with a event. Is
    > it possible?


    Not really, no. Certainly not with any degree of reliability.


    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Mar 1, 2005
    #5
  6. Kamyk

    Kamyk Guest

    I thought that my idea is good, because for example I will have a button
    "Log off" which will delete
    me a value from a record after clicking on. But what about the situation
    when somebody will not
    click on the button "log off" and he close the window. In that situation the
    value which I want to delete
    will be available in the record in the database.

    Please verify my thinking.

    Marcin from Poland
    Kamyk, Mar 1, 2005
    #6
  7. Kamyk wrote:

    > what about the situation when somebody will not click on the button "log
    > off" and he close the window. In that situation the value which I want to
    > delete will be available in the record in the database.


    Do the same as everybody else - accept that HTTP is a stateless protocol and
    have a program that runs on a timer and cleans out sessions that have been
    inactive for $too_long seconds.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Mar 1, 2005
    #7
  8. Kamyk

    Kamyk Guest

    > Do the same as everybody else - accept that HTTP is a stateless protocol
    and
    > have a program that runs on a timer and cleans out sessions that have been
    > inactive for $too_long seconds.


    Could you be so kind and give me the code example, because I`m a the
    beginner
    of HTML and Javascript. I would like to do web page using ASP language
    (vbscript).

    Thank you in advance
    Marcin
    Kamyk, Mar 1, 2005
    #8
  9. Kamyk

    Noozer Guest

    "Kamyk" <> wrote in message
    news:d02lcs$k9u$...
    > I thought that my idea is good, because for example I will have a button
    > "Log off" which will delete
    > me a value from a record after clicking on. But what about the situation
    > when somebody will not
    > click on the button "log off" and he close the window. In that situation

    the
    > value which I want to delete
    > will be available in the record in the database.
    >
    > Please verify my thinking.


    Remember that webpages are "one way"... data comes to the client and the
    client does something. The only way for the client to communicate back to
    the server is to either pass values when loading the next page or save
    cookies before loading the next page. The next page will then act on the
    data it recieves once it's loaded into the client machine. Using ASP you can
    have the server perform some actions on the passed data (but not cookies)
    during execution on the server. You can NEVER count on the next page
    actually being loaded or that the user will close the page or browser
    properly.

    As long as you keep the above in mind you should be able to develop a proper
    program flow.
    Noozer, Mar 1, 2005
    #9
  10. Kamyk

    Adrienne Guest

    Gazing into my crystal ball I observed "Kamyk"
    <> writing in
    news:d02nok$dkq$:

    >> Do the same as everybody else - accept that HTTP is a stateless
    >> protocol and have a program that runs on a timer and cleans out
    >> sessions that have been inactive for $too_long seconds.

    >
    > Could you be so kind and give me the code example, because I`m a the
    > beginner
    > of HTML and Javascript. I would like to do web page using ASP language
    > (vbscript).
    >
    > Thank you in advance
    > Marcin
    >
    >


    You should really post this to an ASP group,
    microsoft.public.inetserve.asp.general would be a good idea, or Google in
    the group in the past month and you might find what you're looking for.

    --
    Adrienne Boswell
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
    Adrienne, Mar 1, 2005
    #10
  11. Kamyk wrote:

    > Could you be so kind and give me the code example, because I`m a the
    > beginner of HTML and Javascript. I would like to do web page using ASP
    > language (vbscript).


    Its not an HTML or JavaScript issue, and I don't do VBScript. Doesn't ASP
    have some prewritten session handling libraries? Most languages do.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Mar 3, 2005
    #11
  12. Kamyk

    Kamyk Guest

    > Its not an HTML or JavaScript issue, and I don't do VBScript. Doesn't ASP
    > have some prewritten session handling libraries? Most languages do.


    Yes, ASP does have session handling libraries, but I don`t know how to use
    them
    to solve my problem. Maybe I have not got a good idea, because I wanted to
    insert a user id into a table using SQL query, and after logging him off, I
    wanted
    delete this user id from the table. After such procedure I will have a list
    of
    currently logged in users. I don`t know how to use sessions to receive the
    same
    data (currently logged users).

    Please help me, if you can

    Marcin
    Kamyk, Mar 3, 2005
    #12
  13. Kamyk

    Norbtach Guest

    There is an event "onunload".
    Try this:
    <body onunload="JavaScript: . . . . . . >
    Robert.

    "Kamyk" <> wrote in message
    news:d024b3$hr6$...
    > Hello all!
    >
    > I know that in HTML there is no such event, but is it possible to make

    event
    > on close a window. If so, please write me example how to do it.
    >
    > Thank you in advance
    > Marcin from Poland
    >
    >
    Norbtach, Mar 4, 2005
    #13
  14. Kamyk

    Adrienne Guest

    Gazing into my crystal ball I observed "Kamyk"
    <> writing in
    news:d07i5e$7pa$:

    >> Its not an HTML or JavaScript issue, and I don't do VBScript. Doesn't
    >> ASP have some prewritten session handling libraries? Most languages
    >> do.

    >
    > Yes, ASP does have session handling libraries, but I don`t know how to
    > use them
    > to solve my problem. Maybe I have not got a good idea, because I wanted
    > to insert a user id into a table using SQL query, and after logging him
    > off, I wanted
    > delete this user id from the table. After such procedure I will have a
    > list of
    > currently logged in users. I don`t know how to use sessions to receive
    > the same
    > data (currently logged users).
    >
    > Please help me, if you can
    >
    > Marcin
    >
    >


    You're going to face some other problems as well. Session variables across
    pages will not work if the user does not accept session cookies. The only
    way to reliably do it is either with hidden input elements or querystring.

    What you could possibly do, however, is do a clean up after a certain
    amount of time, like a if a person has been logged on for more than 24
    hours.

    IIRC there was some discussion on this in
    microsoft.public.inetserver.asp.general I few weeks ago. You might want to
    Google over there to see if anything strikes your fancy.

    --
    Adrienne Boswell
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
    Adrienne, Mar 5, 2005
    #14
  15. Kamyk

    Norbtach Guest

    There is an event "onunload".
    Try this:
    <body onunload="JavaScript: . . . . . . >
    Robert.


    "Kamyk" <> wrote in message
    news:d024b3$hr6$...
    > Hello all!
    >
    > I know that in HTML there is no such event, but is it possible to make

    event
    > on close a window. If so, please write me example how to do it.
    >
    > Thank you in advance
    > Marcin from Poland
    >
    >
    Norbtach, Mar 6, 2005
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWF2ZXJpY2s=?=

    is there any Page OnClose function ?

    =?Utf-8?B?TWF2ZXJpY2s=?=, Jan 20, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,748
    Lau Lei Cheong
    Jan 20, 2005
  2. Kamyk

    OnClose window event

    Kamyk, Apr 16, 2005, in forum: HTML
    Replies:
    4
    Views:
    3,587
    David Dorward
    Apr 17, 2005
  3. marko

    onclose problem

    marko, Aug 19, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    402
    Mark Rae [MVP]
    Aug 20, 2007
  4. Mel

    onClose question...

    Mel, Dec 19, 2004, in forum: Javascript
    Replies:
    6
    Views:
    137
    Grant Wagner
    Dec 21, 2004
  5. Luke Matuszewski

    Gecko DOM window onclose event ?

    Luke Matuszewski, Dec 3, 2005, in forum: Javascript
    Replies:
    6
    Views:
    203
    Thomas 'PointedEars' Lahn
    Dec 4, 2005
Loading...

Share This Page