Results 1 to 4 of 4

Thread: Refreshing the parent window from pop up doesn't work with a Facebook login.

  1. #1
    Join Date
    Jan 2009
    Posts
    82
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Exclamation Refreshing the parent window from pop up doesn't work with a Facebook login.

    I have a facebook login in a pop up window. When the user is logged in, I want it to refresh the parent window and close that pop up.

    Refreshing my parent window doesnt work. Ive debugged and it works when i remove the facebook login and just pop up and empty page. It seems the trip to a different server for the facebook login in the popup breaks the connection between parent and child.

    Is there any way to maintain that connection?

    I'm opening a pop up with:

    Code:
     <a href="javascript:;"  onClick="window.open('/fb/login/','fblogin','width=750,height=650')">
    then I use this to refresh parent and close child window.

    Code:
    <script language="JavaScript">
    <!--
    window.parent.document.location.reload();
    window.close();
     //-->
    </script>
    Last edited by jscheuer1; 07-14-2011 at 03:42 AM. Reason: format code

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by monaya View Post
    Code:
    <script language="JavaScript">
    <!--
    window.parent.document.location.reload();
    window.close();
     //-->
    </script>
    You can't do that because if it worked at all, that would execute right away - you'd never see the popup. And unless it's not a window (like an iframe or frame instead) it's not the parent, it's the opener. But then you couldn't close it anyway. What are you really doing?

    But to answer the question, no. All modern browsers prevent cross domain scripting as a security measure. Since there's no way for them to tell when this is innocent or not, all cross domain scripting is blocked.
    Last edited by jscheuer1; 07-14-2011 at 03:56 AM. Reason: add detail
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jan 2009
    Posts
    82
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Im doing a facebook connect app, so I open a pop up which works. In the pop up, the user logs in through fb. When that's done successfully, i set cookies and then I want to close that pop up and refresh the parent page so the cookies get reflected.

    Everything works but the parent page isn't refreshing when the pop up closes so the user doesn't realize they're actually logged in

    Here's an example http://talkupon.com/16 but you have to login to see what I mean

    Its weird cause it worked at one point, but can't figure why it's not now.

  4. #4
    Join Date
    Jan 2009
    Posts
    82
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Instead of the headache i've just went ahead and changed the login from occurring in the popup to just go through in the same window.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •