Script to recover client

Asked

Viewed 74 times

0

What is called that code that when the customer will leave the page appears a popup with some offer or asking the customer not to leave?

Can anyone give an example of some code?

  • 3

    I don’t know if he has a name, but I’d call him "syrup" or something. Actually this is nothing special, it is simply an "if" that detects when the mouse left the window from the top. It is a good way to try to arrest the client by insisting, since the content is not good enough for this.

  • That’s right, do you know your name? has some sample code?

2 answers

0

Called "Confirmation", browsers implement the global method confirm(mensagem).

This method for the execution of the page, ie, is synchronous, after you receive the response from the client that the page will continue running, it returns true or false (and maybe null).

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

self.onbeforeunload = confirm;

e.g.

That is, it is not possible to choose your own message when leaving the page! Nor with Function#bind (because it creates a new function with the same).

-3

I think you’re referring to alert("mensagem") Javascript. If this is the one, you can find examples and uses here.

  • 1

    While this link may answer the question, it is best to include the essential parts of the answer here and provide the link for reference. Replies per link only can be invalidated if the page with the link is changed. - From Review

  • Understood, thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.