In our web application our main edit page consists of several text editors. When the user changes content in any of the editors, the onbeforeunload event is set to a method to confirm they wish to exit the page. This part is working great.
We are also using a rich:tabPanel on the page. The onbeforeunload event is not triggering when switching between tab panels, which is perfectly fine as I can detect it and put a confirmation on an onclick to verify they wish to leave without saving.
The problem I am seeing occurs after the user has hit cancel on the onbeforeunload confirmation. If, after they have hit cancel on the onbeforeunload, they attempt to move to another tab, the onbeforeunload prompt appears again. If they click cancel the dialog will pop up 3 more times. If they continue to hit cancel it will not switch to the new tab. If they click "Ok", the action that was originally cancelled via onbeforedelete will occur.
1) Change content in an editor. This sets onbeforedelete to function confirmExit.
2) Click on link to another section of the web application. onbeforedelete prompt appears. Press cancel.
3) Click on different tab from the rich:tabPanel. onbeforedelete prompt appears(it shouldn't)
4) Click OK. The original action that was cancelled resumes, and the page navigates to the section of the application selected in Step 2.
Hopefully this gives enough information for someone to have a suggestion.