简体   繁体   English

使用Respone重定向退出弹出窗口

[英]Exit Popup With Respone Redirect

I have a requirement to show an Exit Popup on one of our processing pages. 我需要在我们的其中一个处理页面上显示退出弹出窗口。 I am showing the exit popup by registering a client side javascript like 我通过注册客户端javascript来显示退出弹出窗口

window.onbeforeunload = ShowExitPopUp();

The popup executes fine if you close the window, or try to type in a different URL. 如果您关闭窗口或尝试键入其他URL,则弹出窗口可以正常执行。 However the issue is that my processing page is also performing a "Response.Redirect" on the server side once the process completes. 但是,问题在于,一旦处理完成,我的处理页面也在服务器端执行“ Response.Redirect”。 When response.redirect happens the exitpopup also shows up. 当response.redirect发生时,exitpopup也会显示。 Is there a way to have the exit popup not show up in that case? 在这种情况下,有没有办法使退出弹出窗口不显示?

this is the code below which i am using 这是我正在使用的代码

<script type="text/javascript"> 

window.fbAsyncInit = function() {
    FB.Event.subscribe('comment.create',
    function (response) {
        window.location = "http://domain.com";
    });
    FB.Event.subscribe('comments.remove',
    function (response) {
        window.location = "http://domain.com";
    });   
};

(function() {
    var e = document.createElement('script');
    e.async = true;
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
    document.getElementById('fb-root').appendChild(e);
}());
//]]>
</script>



<script type="text/javascript">
var ShowExitPopup = true;
function ExitPage()
{
if (ShowExitPopup) 
{ 
ShowExitPopup = false;
location.href = "http://www.YOURURL.com/destination";
return '****************************************\n\YOUR HEADLINE\n\n YOUR TEXT1 \n\n  YOUR TEXT "\n\n                                                                                                     | |\n                                                                                                     | |\n                                                                                                    V V\n                                                      96+                                                v\n  ********************************************************\n';
}
} 
</script>
if (document.getElementById('<%=Panel.ClientID %>').style.display == "") {
$find("<%= Popup.ClientID %>").hide();
document.getElementById("<%= btncloseAcc.ClientID %>").click();
}

try this.......... 尝试这个..........

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

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