Logo Search packages:      
Sourcecode: xulrunner version File versions  Download package

nsIXMLHttpRequest Interface Reference

import "nsIXMLHttpRequest.idl";

Inheritance diagram for nsIXMLHttpRequest:

nsISupports

List of all members.


Detailed Description

Mozilla's XMLHttpRequest is modelled after Microsoft's IXMLHttpRequest object. The goal has been to make Mozilla's version match Microsoft's version as closely as possible, but there are bound to be some differences.

In general, Microsoft's documentation for IXMLHttpRequest can be used. Mozilla's interface definitions provide some additional documentation. The web page to look at is http://www.mozilla.org/xmlextras/

Mozilla's XMLHttpRequest object can be created in JavaScript like this: new XMLHttpRequest() compare to Internet Explorer: new ActiveXObject("Msxml2.XMLHTTP")

From JavaScript, the methods and properties visible in the XMLHttpRequest object are a combination of nsIXMLHttpRequest and nsIJSXMLHttpRequest; there is no need to differentiate between those interfaces.

From native code, the way to set up onload and onerror handlers is a bit different. Here is a comment from Johnny Stenback <jst@netscape.com>:

The mozilla implementation of nsIXMLHttpRequest implements the interface nsIDOMEventTarget and that's how you're supported to add event listeners. Try something like this:

nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(myxmlhttpreq));

target->AddEventListener(NS_LITERAL_STRING("load"), mylistener, PR_FALSE)

where mylistener is your event listener object that implements the interface nsIDOMEventListener.

The 'onload', 'onerror', and 'onreadystatechange' attributes moved to nsIJSXMLHttpRequest, but if you're coding in C++ you should avoid using those.

Conclusion: Do not use event listeners on XMLHttpRequest from C++, unless you're aware of all the security implications. And then think twice about it.

Definition at line 106 of file nsIXMLHttpRequest.idl.


Public Member Functions

void abort ()
string getAllResponseHeaders ()
ACString getResponseHeader (in AUTF8String header)
void init (in nsIPrincipal principal, in nsIScriptContext scriptContext, in nsPIDOMWindow ownerWindow, in nsIURI baseURI)
void open (in AUTF8String method, in AUTF8String url)
void openRequest (in AUTF8String method, in AUTF8String url, in boolean async, in AString user, in AString password)
void overrideMimeType (in AUTF8String mimetype)
void send ([optional] in nsIVariant body)
void sendAsBinary (in DOMString body)
void setRequestHeader (in AUTF8String header, in AUTF8String value)
Methods
 NS_IMETHOD_ (nsrefcnt) Release(void)=0
 NS_IMETHOD_ (nsrefcnt) AddRef(void)=0
NS_IMETHOD QueryInterface (REFNSIID aIID, void **aInstancePtr)=0

Public Attributes

readonly attribute nsIChannel channel
attribute boolean mozBackgroundRequest
attribute boolean multipart
attribute nsIDOMEventListener onreadystatechange
readonly attribute long readyState
readonly attribute AString responseText
readonly attribute nsIDOMDocument responseXML
readonly attribute unsigned long status
readonly attribute AUTF8String statusText
readonly attribute
nsIXMLHttpRequestUpload 
upload
attribute boolean withCredentials

The documentation for this interface was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index