If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I have a login window and I want to exec a script in the server if someone:

1) close the browser window

The first one is a problem only in the Netscape browser, because the event OnUnload in the Internet Explorer works when someone close or refresh the browser window, in the Netscape is only executed when someone refresh the browser window.

2) turn off the computer

This is a hard problem, because in both browsers the event OnUnload is not executed.

Because of these two problens I´m asking if an Applet Java could do this.

For the first problem, that's basically what I was suggesting. I think it might be a good idea to put that post on a JavaScript forum. Someone might know the function name for navigator (this still wouldn't work if someone has JavaScript disabled, though).

An applet might solve your problems by using the public void destory method as:

"The destroy method is called when the browser exits. Your applet should implement this method to do final cleanup such as stop live threads."

Give it a try.

The second problem is really difficult. It would be really difficult to distinguish between your program simply being terminated and your computer shutting down. I can't think of a nice way of doing it.