Hey guys, yea I suppose this could be asked at any old javascript forum but maybe someone here has come across this.
I'm writing a Twitter widget with Dashboard. Twitter requires basic HTTP authentication and with the XMLHttpRequest() class that can be done in one of two ways:
Or, instead of the URL:
So both of these methods work fine, when the authentication is successful. When it isn't it seems to thing just skips back after send() with no exception to catch, and no status code to indicate this.
Anyone have any ideas on how to do this correctly?
I'm writing a Twitter widget with Dashboard. Twitter requires basic HTTP authentication and with the XMLHttpRequest() class that can be done in one of two ways:
Code:
[COLOR="red"]var feedURL = "http://" + username + ":" + password + "@twitter.com/statuses/friends_timeline.xml";[/COLOR]
var xmlRequest = new XMLHttpRequest();
xmlRequest.onreadystatechange = function() { xmlLoaded(xmlRequest); };
xmlRequest.open("GET", feedURL, true);
xmlRequest.send(null);
Or, instead of the URL:
Code:
var feedURL = "http://twitter.com/statuses/friends_timeline.xml";
var xmlRequest = new XMLHttpRequest();
xmlRequest.onreadystatechange = function() { xmlLoaded(xmlRequest); };
[COLOR="Red"]xmlRequest.open("GET", feedURL, true, username, password);[/COLOR]
xmlRequest.send(null);
So both of these methods work fine, when the authentication is successful. When it isn't it seems to thing just skips back after send() with no exception to catch, and no status code to indicate this.
Anyone have any ideas on how to do this correctly?