How to handle Leave Site pop using Java Script code

Hello All,
We want to Handle Leave Pop up as show below using Java Script Only.

Can some one help us with Java script query to execute leave page pop. we dont want to use Click or other components.


Can you open Dom viewer (using F12 key in most cases) and check what properties for the element are visible if any id or class or name?
So we can use that to click.