Confirm on exit modal

Hi,
First, I would like to ask if there is a way to manually create exit button for modal. I tried all kinds of sc_exit(), but didn’t work.

If it’s not possible, then is there any way to call confirm message when exit modal?

Thanks!