在浏览器/选项卡关闭时仅显示一次用户的自定义弹出窗口,或者当用户将鼠标悬停在浏览器栏或关闭按钮上时显示弹出窗口



我的目的是直接显示我想在浏览器/选项卡/窗口关闭时向我的网站用户显示的自定义弹出窗口。如何跟踪浏览器/标签关闭?我使用了onbeforeunload((方法,但它向我显示离开/停留消息。我不想向用户显示该消息。有没有其他方法可以跟踪用户是否悬停在浏览器栏或浏览器关闭按钮上?任何帮助将不胜感激!

<div id="promocode_popup" class="popup hide" runat="server">
<p class="popupText2">Enter your email to receive Promocode</p>
<strong class="strongText">10% OFF!</strong>
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
<asp:LinkButton ID="btn_Submit" runat="server" OnClick="btn_Submit_OnClick" >Send Coupon!</asp:LinkButton>
</div>

<script type="text/javascript">   
window.onbeforeunload = function () {
Unhide('promocode_popup');       
return "hi";
};
</script>

简短的回答是NO的。 您必须尊重用户离开页面的决定。浏览器显示的消息无法修饰。

最新更新