如何弹出当访问者从网站退出弹出、访问者、网站

2023-09-10 14:30:21 作者:在成长中疼痛过的人

我公司创建网络调查,并偶尔有人问我,如果我们可以做一个网站退出调查。因此,当访问者即将离开现场了弹出出现,询问他们是否愿意采取了快速调查。通过弹出我指的是一个浮动的CSS DIV,而不是一个子窗口(虽然有时客户并没有意识到这一点)。

My company creates web surveys and once in a while I get asked if we can do an exit survey on a website. So when a visitor is about to leave the site a "popup" appears asking if they'd take a quick survey. By "popup" I'm referring to a floating CSS div, not a child window (although sometimes clients don't realise this).

从技术上可以codeA真正退出调查?

Is it technically possible to code a genuine exit survey?

我不这么认为,但我失去了一些东西?在 onbeforeunload的事件已接近所需要的功能,但该消息和按钮都没有完全customiseable,使其可用。

I don't think so but am I missing something? The onbeforeunload event is close to the functionality required but the message and buttons aren't fully customiseable to make it usable.

目前的趋势,实现退出的调查是弹出一个邀请在访问的开始,如果用户说OK,然后一个子窗口被打开,焦点设置返回主窗口。在访问结束时,用户看到的子窗口。我发誓我(巧合除非)从来没有见过一个弹出退出的调查。

The current trend for implementing an exit survey is to popup an invite at the start of the visit, and if the user says ok then a child window is opened and focus set back to the main window. At the end of the visit the users sees the child window. I swear I've never seen a "popup on exit" survey (unless by coincidence).

推荐答案

当然,他们退出的网站关闭窗口/标签?你问的方式prevent他们关闭的选项卡?或弹出截至收盘行动引发了窗口?这听起来像这将是由浏览器有充分的理由pvented $ P $,如果你发现了一个变通办法,很可能会被固定在未来的版本。

Surely they 'exit' the site by closing the window/tab? You're asking for a way to prevent them closing the tab? Or popup a window triggered by the close action? That sounds like it would be prevented by the browser for good reason, and if you found a workaround it would be likely to be fixed in future versions.