Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

nsIXMLHttpRequest.setRequestHeader exception in Firefox

2:32 pm on Oct 11, 2005 (gmt 0)

New User

10+ Year Member

joined:Nov 1, 2003
votes: 0

There is an older thread (now closed), [webmasterworld.com...] which is the first hit on google now when you search for the Firefox exception, nsIXMLHttpRequest.setRequestHeader . It looks something like :

Error: uncaught exception: [Exception... "Component returned failure code: 0x804b000f [nsixmlhttprequest.setrequestheader]" nsresult: "0x804b000f (<unknown>)" location: "JS frame :: [emp.kneedraggers.com...] :: populate_bike_makes :: line 173" data: no]

What the thread didn't mention is that actually this happens when you call setrequestheader() before calling open(), like so :

var http = new XMLHttpRequest();
http.setRequestHeader('X-Request-Type','DATA'); # exception raised here

which, intuitively doesn't seem all that wrong. The fix is simply to call open first like :

var http = new XMLHttpRequest();


hope this saves someone the head scratching that it caused me!