|
Java™ by example!
|
|
|
How do I detect with an Applet that a browser window has been closed?
You can do applet to applet communication over browser instances by means of static variables, since they all share the same runtime environment. So, to find out whether a browser window, that was previously opened, is closed, you simply need to embed a small hidden applet that implements the destroy method (called when the browser exits) in which it changes the state of a static field. Here's an proof of concept. You may want to generalize all of this. http://www.esus.com/applets/CloseDetect.html CloseDetect.java:
CloseListener.java:
Shared.java:
CloseDetectAux.java:
CloseDetect.html:
CloseDetectAux.html:
[This has been tested with IE5.5]
Further Information
Author of answer: Joris Van den Bogaert
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|