I am writing an application in GWT and I need to detect when a user navigates away from my application or when he closes the browser window (onUnload event) and do a logout
Looks like GWT does have an event for exactly this.
ClosingEvent.
Looks like you need to implement a ClosingHandler