Parent window focus problem - iPhone

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • premchandj
    New Member
    • Sep 2012
    • 1

    Parent window focus problem - iPhone

    Hi All,

    I am having a peculiar problem with a website i am developing. The problem *only* happens on the iPhone(safari).


    My setup is as follows.


    1) I have a CLIENT page - shows an initial page, and has a login button.


    2) User clicks on the LOGIN button, and is shown a LOGIN popup/new-window (this is created by posting a form using jquery 'submit' function with target='_blank' )
    ====
    CLIENT.html


    Code:
    var formData = '<form style="display: none; margin: 0; padding: 0; border-width: 0; overflow: hidden;" id="MyFormId" action="https://MYSERVER.COM/v2/widgets" method="POST" target="_blank"><input type="hidden" name="action" value="connect"/><input type="hidden" name="referringURL" value="http://MYCLIENT.com/ClientPage.html"/><input type="hidden" name="cartOwnerId" value="A2R6QUFKT17A1O"/></form>';
     
     
    jQuery("#"+this.getLocation()).append(formData);
     
     
    jQuery("#"+formIdName).submit();
    ====


    3) User enters credentials on LOGIN window, and submits. A call is made to the SERVER to authenticate. On SUCCESSFUL authentication, we want to
    * CLOSE the LOGIN window
    * REDIRECT Client page to new URL


    4) Everything works as planned, EXCEPT that the Client window (that created the LOGIN popup/new window), does not return to full-screen (after the LOGIN window closed).


    If i try to put a window.opener.f ocus() in the LOGIN page javascript, i get focus on the CLIENT page, but the LOGIN page does not close(even if i put window.close before the window.opener.f ocus())
    ====
    LOGIN html
    Code:
    jQuery(document).ready(function() {
          ...
          ...
     
            window.close();
     
            window.opener.focus()
        });
    ====


    Is there any tips on how i can close the LOGIN window, and redirect the client page to a new URL, and make the Client window full screen?


    Any tips would be appreciated.


    Thanks
    Last edited by gits; Sep 12 '12, 08:08 AM. Reason: added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    How about closing the child window (login) from the parent (client)? Keep a reference to the opened window, then use it to close the window:
    Code:
    var loginWin = window.open(...);
    ...
    // call in a function called from child?
    loginWin.close();

    Comment

    Working...