How To Close Popup Window And Redirect To Parent Window

How To Close Popup Window And Redirect To Parent Window

When we click login Facebook redirect to in the popup.But we need to redirect from popup window to parent window after that close popup when user click on login/allow button.

We can use for this ClientScript.RegisterStartupScript function and write java-script code and after that it`ll be close automatically.

Below code we can use where we need to open & close popup from code (C#)
 
Code

Function  
  1. public void RedirectToParent(string url, Type type)  
  2.         {  
  3.             string js = "";  
  4.             js += "window.opener.location.href='" + url + "';";  
  5.             js += "window.close();";  
  6.             ClientScript.RegisterStartupScript(type, "redirect", js, true);  
  7.   
  8.         }  
Calling Function 
  1. Type type = this.GetType();  
  2. RedirectToParent("http://www/xyz.co/...", type);  
Ebook Download
View all
Learn
View all