简体   繁体   English

使用javascript / jquery在窗口关闭时弹出模态

[英]Modal popup on window close using javascript/jquery

I have a website where the customers come and purchase any product. 我有一个网站,客户可以在那里购买任何产品。 But there are some customers who closes the tab without doing any purchase. 但是,有些客户没有进行任何购买就关闭了标签页。 I don't want to lose those customers. 我不想失去那些顾客。 So i have decided to provide offers for those customers in the "modal" popup. This popup has to be displayed once the customer clicks the close button in the browser 因此, i have decided to provide offers for those customers in the "modal" popup. This popup has to be displayed once the customer clicks the close button in the browser i have decided to provide offers for those customers in the "modal" popup. This popup has to be displayed once the customer clicks the close button in the browser . i have decided to provide offers for those customers in the "modal" popup. This popup has to be displayed once the customer clicks the close button in the browser This popup will have a form to select the offers, fill their contact details and submit the form. popup will have a form用于选择要约,填写其联系方式并提交表格。 Once the form gets submitted, the window can be closed automatically. 提交表单后,可以自动关闭窗口。 Is it possible to provide such a popup modal. 是否可以提供这样的弹出模式。 I have surfed regarding this. 我已经为此冲浪了。 Everyone says about the onbeforeunload with confirm and alert box. 每个人都对带有confirmalert框的onbeforeunload说。 Could anyone help me on this. 谁能帮助我。

What you are trying to do cannot be done. 您尝试做的事情无法完成。 That is after the user has clicked on close there is no way to do it. 也就是说,在用户单击关闭后,将无法执行此操作。
But I think what you are looking for is what is called a 'Exit intent popup'. 但是我认为您正在寻找的是所谓的“退出意图弹出窗口”。
The idea is simple: you use js/jquery to find if the user is 'about to' close the page(say from mouse movements and such) and display the said popup. 这个想法很简单:您使用js / jquery查找用户是否“即将”关闭页面(例如,通过鼠标移动等)并显示所述弹出窗口。
Here is one such plugin : BIOEP 这是一个这样的插件: BIOEP

You can just google 'Exit intent popups' for many more. 您可以使用Google“退出意图弹出窗口”进行更多操作。

您无法从页面代码中做到这一点,只能在扩展名中看到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM