开发者

Open Popup when user leaves the site ( but not when user clicks on an internal link )

开发者 https://www.devze.com 2023-01-06 19:19 出处:网络
here is what i need to do: i want to launch a popup window when the user exits the website. i found code that detects when the user closes the window, but that same code ALSO fires when the user cli

here is what i need to do:

i want to launch a popup window when the user exits the website.

i found code that detects when the user closes the window, but that same code ALSO fires when the user clicks on an internal link. ( which i dont want )

any ideas how to do this? Ive looked everywhere and i cant find a clear solution.

this solution needs to work on all 3 browsers : FFox /开发者_JAVA百科 IE / Safari!

thanks!


You can't, there is no such event that will be triggered when someone exits the site. That's why in the early 2000s someone too clever invented "pop-unders": popups that will open immediately, but will be put on the background, behind the browser's window.

Which are one of the most annoying things on the web, and the first ones that any popup blocker or antivirus will kill :) On the other side, there are legitimate uses for that, like most surveys you see (I got one from microsoft some days ago).

Never rely on popups, unless you are writing an intranet site, or one where you are sure all of your visitors will not have a popup blocker.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号