onbeforeunload logic for multiple controllers on same path