#30: use beforeunload event
up 0.6.226