How Do I Use jQuery/JavaScript To Open A Popup Window/Tab (ASPX Login Page) & Then Pass Values To Op

Posted by Terry Robinson on Stack Overflow See other posts from Stack Overflow or by Terry Robinson
Published on 2010-04-29T14:01:08Z Indexed on 2010/04/29 14:07 UTC
Read the original article Hit count: 624

Filed under:
|
|
|
|

Hi All,

We currently have two asp.net 2.x web applications and we need to perform the following functionality:

From one application, we want to auto-login to the other web application automatically in a new tab; using the same browser instance/window.

So the process is:

Open New Window/Tab With Second System URL/Login Page Wait For Popup Window/Tab Page To Load (DOM Ready?)

OnPopupDomReady { Get Usename, Password, PIN Controls (jQuery Selectors) and Populate In Code Then Click Login Button (All Programatically). }

I am currently using JavaScript to Open the window as follows:

<script type="text/javascript">
  $(document).ready(function () {
    $('a[rel="external"]').click(function ()
       {
         window.open($(this).attr('href'));
         return false;
       });
      });  
</script>

I would like to use jQuery chaining functionality if possible to extent the method above so that I can attach a DOM Ready event to the popped up page and then use that event to call a method on the code behind of the popped up page to automatically login. Something similar to this (Note: The Following Code Sample Does Not Work, It Is Here To Try And Help Illustrate What We Are Trying To Achieve)...

 <script type="text/javascript">
    $(document).ready(function () {
      $('a[rel="external"]').click(function () {
        window.open($(this).attr('href').ready(function ()
        {
           // Use JavaScript (Pref. jQuery Partial Control Name Selectors) To Populate Username/Password TextBoxes & Click Login Button.
        })
      });

    });  
  </script>

Our Architecture Is As Follows: We have the source for both products (ASP.NET WebSite[s]) and they are run under different app. pools in IIS.

I hope this all makes sense, and if my plan is not going to work, please provide hints ;)

Thanks All/Kind Regards,

Terry Robinson.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about popup