string dialog_url = "http://www.facebook.com/dialog/oauth?client_id=" + app_id + "&redirect_uri=" + Server.UrlEncode(my_url) + "&scope=" + permission;
ClientScript.RegisterClientScriptBlock(typeof(Page), "key", "window.open('"+dialog_url+"','_parent','');");
I use this code for popup permission dialog. When user click allow facebook redirect user to my app in the popup. I need to send code from popup window to parent window then close popup when user click allow.
Tell me if this is what you are looking for...
Parent Window:
<html>
<head>
<script language="Javascript">
function showFBWindow(){
url = "allowfbchild.html"
newwindow=window.open(url,'name','height=200,width=150');
if (window.focus) {newwindow.focus()}
}
</script>
</head>
<body>
<input type="button" OnClick="showFBWindow()" value="Open FB" />
</body>
</html>
Child Window(allowfbchild.html) :
<html>
<head>
<script language="Javascript">
function redirectToFB(){
window.opener.location.href="http://wwww.facebook.com";
self.close();
}
</script>
</head>
<body>
Allow the user to view FB
<br/>Are you sure?
<input type="button" value="Ok" OnClick="redirectToFB()" />
</body>
</html>
in the parent page write the javascript as below
<script language="Javascript">
function popitup(url)
{
newwindow = window.open(url, "popwin", "width = 320, height = 210, resizable = no");
if (window.focus) { newwindow.focus() }
return false;
popwin.moveTo(0, 0);
}
</script>
<a href="" onclick="return popitup('myapppopup.aspx');return false;">`myapppopup</a>`
then in the popup windows add a link to facebook as below
<a href="http://wwww.facebook.com" target="_blank" onclick="self.close();">facebook </a>