Rich-text Reply

Is possible show a pop-up when the visitors is going to close the browser tab?

miguelm 10-20-15

Is possible show a pop-up when the visitors is going to close the browser tab?

Hi,

 

I would like to detect when the user is going to close the browser window to show him a pop-up if is trying to leave our website. Is anyone do an activation rule like that?

 

I know there are some tools that offers this service (I guess that this tool is detecting by javascript that the user is moving the mouse to the left corner), , so could be great do it with Optimizely custom javascript.

 

Thank you!

Level 2

robertchan 10-26-15
 

Re: Is possible show a pop-up when the visitors is going to close the browser tab?

Hi,

I don't think the level of effort would be worth what you're going for, but you could set a time out function to have a modal show up if an element on your page exists. For example:

// check if an element exists
if (yourElement.length) {
//set a time out and use a method like scoping out to window for "fadeIn"
}
Robert Chan