hook in  onbeforeunload for urls other than localhost