0

Im trying to use DefaultHttpClient to log into xbox.com. I realize that you cant be logged in without visiting http://login.live.com, so I was going to submit to the form on that page and then use the cookies in any requests to xbox.com.

The problem is that requesting anything from live.com using DefaultHttpClient returns the followings message.

Windows Live ID requires JavaScript to sign in. This web browser either does not support JavaScript, or scripts are being blocked.

How do I tell DefaultHttpClient to tell the server that javascript is available for use? I tried looking in the default options and also adding it as a parameter object but I cant see what I've got to do.

MrSmith42
  • 9,961
  • 6
  • 38
  • 49

3 Answers3

0

Windows Live ID requires JavaScript to sign in. This web browser either does not support JavaScript, or scripts are being blocked.

To find out whether your browser supports JavaScript, or to allow scripts, see the browser's online help.

nirmal
  • 1
0

Use Wireshark to trace the communication using both a browser and your program, and look for the differences. It's hard to say what, exactly, live.com/xbox.com are looking for, but there is likely some AJAX-y code used to get the actual content.

Jonathan
  • 13,354
  • 4
  • 36
  • 32
0

The reason this is happening is that this line of HTML is getting parsed from live:

<noscript><meta http-equiv="Refresh" content="0; URL=http://login.live.com/jsDisabled.srf?mkt=EN-US&lc=1033"/>Windows Live ID requires JavaScript to sign in. This web browser either does not support JavaScript, or scripts are being blocked.<br /><br />To find out whether your browser supports JavaScript, or to allow scripts, see the browser's online help.</noscript>

Which is used to redirect you if your client does not have javascript enabled (and therefore will parse <noscript> tags.)

You could try to use a less intelligent HTTP library which does no parsing of the content, but which instead simply does the transport and leaves the parsing to you.

Reese Moore
  • 11,524
  • 3
  • 24
  • 32
  • 1
    Thanks. I didnt spot the noscript. You can actually tell DefaultHttpClient what to do when a redirect occurs using a redirect handler. I added a handler and it worked like a charm. I can see the login form and am now coding something to submit a form request with all of the forms perameters. Anyone interested in blocking the redriect can see how its done here - http://stackoverflow.com/questions/1352949/preventing-httpclient-4-from-following-redirect – Stuart Crouch Nov 10 '10 at 14:13