Is there a way to set up a pop up for when someone is leaving a page?

I have created my pop-up for feed email subscription. I would like to know if there is a way for it to pop-up before they leave the page instead of when they land?