Page 1 of 1

closing a window - in depth?

Posted: Thu May 15, 2003 5:30 am
by Guy
first, it's not for pop-up.
I have a web application, in which I open a window and connect to a device.
there I have a page with tabs that loads the same page with different parameters.
I have a close button, when it's pressed I close the connection.
the problem is if the user pressed the X button at the top right corner.
I have to close the connection ( closing the connection is by sending a string to a the server through socket)
onUnload is not good (I think ) because every time I move with the tabs I load the page again - but the connection
should still be open.
can it be done?
Thanks
Guy

Posted: Thu May 15, 2003 6:35 am
by Gleeb
While it may look ugly, you might try frames. You say it's a web-app, so the address bar can be sacrificed, I'd assume.

Posted: Thu May 15, 2003 7:53 am
by Guy
i dont use the address bar.
but i dont understand how can frames help me here.
please explain what do yo mean.
Thanks
Guy

Posted: Thu May 15, 2003 7:57 am
by Gleeb
Well, if you have the webapp in frames, where one frame is not visible, and the other one has the actual application in, when you close the window, it'll activate the onUnoad you hid in the invisible frame.

That way, you keep the connection open while you're using the app, and when you close the window, the connection can be broken :)

Posted: Thu May 15, 2003 8:04 am
by Guy
Gleeb wrote:While it may look ugly.
ugly, but will work. thanks.
I 'm open for other suggestions,
is there a way to disable the X (close) button?
Guy

Posted: Thu May 15, 2003 11:15 am
by volka
no, and would you want any moron out there on web to be able to bar you from closing the browser on your computer? ;)

Posted: Fri May 16, 2003 4:14 am
by Gleeb
Actually, there is, but it's a practice that can cause instability in any browser.