Prompt user to confirm when navigating off the WebViewer page if they have unsaved annotations

I would like to prompt the user to confirm if they try to navigate away from the page displaying a document in WebViewer (or they try to close the browser, or refresh the page), but I only want to prompt them if they have any unsaved Annotations.

I am planning on using window.onbeforeunload to achieve this, but need to figure out when to throw up the message.

Therefore, Is there any way to determine whether there are any unsaved annotations?

Alternatively, does the WebViewer provide any functionality for prompting the user to save annotations before leaving the page?

I don't want to go down the background/auto save path, as the users want to remain in control of when they do and don't save.


Looks like this message was posted in the wrong forum. For WebViewer forum/KB is!forum/pdfnet-webviewer

Do we have any answers for the above query to use a prompt for unsaved annotations?