Exit Popup With Respone Redirect

Posted by Gaur1982 under ASP.NET on 6/26/2012 | Points: 10 | Views : 8015 | Status : [Member] | Replies : 1
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

window.onbeforeunload = ShowExitPopUp();

The popup executes fine if you close the window, or try to type in a different URL. However the issue is that my processing page is also performing a "Response.Redirect" on the server side once the process completes. When response.redirect happens the exitpopup also shows up. Is there a way to have the exit popup not show up in that case?

Since my server side code is running through an UpdatePanel, so I have tried registering the following, in an attempt to remove ExitPopup from client side. However this doesn't work since server side redirection happens before end request.

<script type="text/javascript"> 

window.fbAsyncInit = function() {
function (response) {
window.location = "http://domain.com";
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';

Gaurav Agrawal


Posted by: Muralidosscm on: 6/26/2012 [Member] Starter | Points: 25

if (document.getElementById('<%=Panel.ClientID %>').style.display == "") {
$find("<%= Popup.ClientID %>").hide();
document.getElementById("<%= btncloseAcc.ClientID %>").click();
try this..........

Muralidoss M

Gaur1982, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response