Script to recover client

0

How do you call that code that when the client leaves the page pops up with some offer or asking the client not to leave?

Can anyone give an example of some code?

    
asked by anonymous 18.10.2016 / 03:33

2 answers

0

If it is called "Confirmation", browsers implement the global method confirm(mensagem) .

This method for page execution, that is, is synchronous, after you receive the response from the client that the page will continue to run, it returns true or false (and maybe null ). / p>

The "beforeunload" event allows the confirm method to display this type of confirmation before exiting the page if it is set to pure confirm , without using DOM add event methods:

self.onbeforeunload = confirm;

That is, you can not choose your own message when you leave the page! Not even with Function#bind (because it creates a new function with it).

    
18.10.2016 / 12:31
-3

I think you're referring to alert("mensagem") of Javascript. If so, you can find examples and uses here.

    
18.10.2016 / 03:37