+ Start a Discussion
Radhika Pawar 12Radhika Pawar 12 

How to handle and show alert on browser close or url change event?

I want to make user mandatorily click on a particular button which is displayed on VF page. I want to throw an alert message if the user leaves the page or closes the tab or browser or URl is changed?
bilal malikbilal malik
You can embed javascript code into your visualforce page to acheive this functionality.

javascript functions : window.onfocus , window.onblur and url changing events , these functions will help you out.