I am currently working on an application where I need to query the user before they navigate away from a page. For example, when users have changed data on the screen, but have not yet saved it and they try to move to another page they are shown a warning message.