Search code examples
javascripthtmlnetwork-programmingwindows-desktop-gadgets

Javascript: Client side filling in Input fields on Server side


(I'm scripting in Windows, for use in a Windows 7 gadget) Hi there, I'm trying to log in to a page on a server machine from a client machine using a ServerXMLHTTP request. I'm wondering if there's a way to fill in the input fields in the server's input fields and then making the server run the authorization on the information, and return the new URL. However, right now the main question I have is how would I go about logging in? Also, I tried passing the log in information in as parameters and it didn't seem to work out very well.

this.requests[1].open("POST", "https://" + this.address, true);
this.requests[1].setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
this.requests[1].send("username=user&password=pass");

Solution

  • according to http://it.toolbox.com/wiki/index.php/Sending_ServerXMLHTTP_login_credentials it looks like the username and password are the 4th and 5th parameters respectivly in the open function. So...

    this.requests[1].open("post","https://"+this.address, true, "user_name", "p4ssword");