Has anyone used XMLHttpRequest on a web page requiring password
authentication? I can't get it to work. Would someone look over my
code and see if I'm doing something obviously wrong?
I have a Linksys router that I'm trying to pull information from to
display in a widget. I started with Apple's Blank Widget, adding code
to request a web page. It works fine with a normal (no password
required). Running it in Dashboard does not work on the linksys
page, even when sending the password in the XMLHttpRequest.open
function. But when I open the .html file in Safari, it pops open a
username/password box. I enter the password and it displays correctly.
My BlankWidget.js is:
-----
function setup()
{
//target = "http://www.slashdot.org";
target = "http://192.168.1.1/WL_ActiveTable.asp";
loadXMLDoc(target);
return 0;
}
function loadXMLDoc(url) {
debug(url);
xmlRequest = new XMLHttpRequest();
xmlRequest.setRequestHeader("Cache-Control", "no-cache");
--> http://192.168.1.1/WL_ActiveTable.asp // in Safari
--> readyState is 1
--> undefined // the Safari username/password popup
happens here
--> readyState is 2
--> 200
--> readyState is 3
--> 200
--> readyState is 4
--> 200
----
So it seems that adding a username/password to XMLHttpRequest.open
does absolutely nothing. The linksys only uses the password, and
ignores a username. Even changing the username above from "" to
"ignoreme" has no effect.
Suggestions?
Thanks,
Danny
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden