bind "beforeunload" on view-snippet page