record if trying to leave the page