closing a window - in depth?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Guy
Forum Commoner
Posts: 53
Joined: Sun Jan 12, 2003 3:34 am

closing a window - in depth?

Post 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
Gleeb
Forum Commoner
Posts: 87
Joined: Tue May 13, 2003 7:01 am
Location: UK
Contact:

Post 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.
User avatar
Guy
Forum Commoner
Posts: 53
Joined: Sun Jan 12, 2003 3:34 am

Post 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
Gleeb
Forum Commoner
Posts: 87
Joined: Tue May 13, 2003 7:01 am
Location: UK
Contact:

Post 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 :)
User avatar
Guy
Forum Commoner
Posts: 53
Joined: Sun Jan 12, 2003 3:34 am

Post 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
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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? ;)
Gleeb
Forum Commoner
Posts: 87
Joined: Tue May 13, 2003 7:01 am
Location: UK
Contact:

Post by Gleeb »

Actually, there is, but it's a practice that can cause instability in any browser.
Post Reply