dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: Adding a username/password to a URL or passing username/password to another URL

Hybrid View

  1. #1
    Join Date
    Dec 2012
    Posts
    81

    Adding a username/password to a URL or passing username/password to another URL

    Hi All...

    I want the following logic to happen.

    ButtonClick > New window opens > Username/Password are already entered > User clicks 'Login' and is logged into the appropriate site.

    I'm at a loss... I've seen this occur before (Yes... after IE fixed the issue with IE6+), but I can't figure it out on my own... Need some help.

    I've tried this...

    Code:
    Username:PassWord1@university.edu/portal/server.pt
    and this... (using query parameters)

    Code:
    https://xxx.university.edu/portal/server.pt?userName=SomeUser&password=somePassword
    ...but no luck. Wondering if there's a JS for this that would work in IE8?

    Regards,
    ____________________________________
    sƃoɹɟqǝʍ Design Studios
    Phoenix | Arizona

    E: webfrogs@webfro.gs

  2. #2
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,287
    Use encodeURIComponent with the params

  3. #3
    Join Date
    Dec 2012
    Posts
    81
    The params are in the URL. encodeURIComponent is a JS function. How would I implement that into the URL?
    ____________________________________
    sƃoɹɟqǝʍ Design Studios
    Phoenix | Arizona

    E: webfrogs@webfro.gs

  4. #4
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,287
    If you want to pass the parameters in URL with a GET request, call the server with javascript like this (W3Crecommandation The "get" method restricts form data set values to ASCII characters):
    Code:
    // the two value (javascript variables) 
    var usrName=document.getElementById('idusrName').value;
    var pssWord=document.getElementById('idPssword').value;
    
    // The call
    document.location='https://xxx.university.edu/portal/server.pt?username='+encodeURIComponent(usrName)+'&password'+encodeURIcomponent(pssWrd);
    This lines are only to write in a submit function...
    Then you have not to decode on the server with the $_GET in PHP (See the note on this page).
    Last edited by 007Julien; 08-07-2013 at 05:09 PM.

  5. #5
    Join Date
    Dec 2012
    Posts
    81
    What if I were to contain the school login site on our intranet site, inside an iframe? Would that make any difference?
    ____________________________________
    sƃoɹɟqǝʍ Design Studios
    Phoenix | Arizona

    E: webfrogs@webfro.gs

  6. #6
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,715
    why don't you just try it instead of asking? ))
    signature under construction

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles