beforeUnload handler working in every browser except Firefox