iOS/Mobile Safari support via beforeunload shim.