Use onunload to disconnect web channel

FF does not support disconnection from beforeunload.