Can't there be an attribute to check for the leave page request and click it?