This plugin demonstrates how to intercept Flex Actions and prevent them for being called
Let's say there is an CRM record on screen, or media playing that will be cancelled should the user attempt to move away from the current view. To prevent this the user can prompted with a browser native dialog that will enable them to confirm the action.