function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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.