See the dojox/io/xhrPlugins reference documentation for more information.
Adds W3C Cross site XHR or XDomainRequest handling for the given URL prefix
This can be used for servers that support W3C cross-site XHR. In order for a server to allow a client to make cross-site XHR requests, it should respond with the header like:
Access-Control: allow <*>
Parameter | Type | Description |
---|---|---|
url | undefined | Requests that start with this URL will be considered for using cross-site XHR. |
httpAdapter | undefined | sent with XDR, so you can use a convention for headers and PUT/DELETE methods. |
adds a server side proxy xhr handler for cross-site URLs
Parameter | Type | Description |
---|---|---|
proxyUrl | undefined | This is URL to send the requests to. |
Define a proxy:
dojox.io.xhrPlugins.addProxy("/proxy?url=");
And then when you call:
dojo.xhr("GET",{url:"http://othersite.com/file"});
It would result in the request (to your origin server):
GET /proxy?url=http%3A%2F%2Fothersite.com%2Ffile HTTP/1.1
Provides a HTTP adaption.
The following convention is used: method name -> ?http-method=PUT Header -> http-Header-Name=header-value X-Header -> header_name=header-value
Parameter | Type | Description |
---|---|---|
plainXhr | undefined | |
noRawBody | undefined |
dojox.io.xhrPlugins.addXdr("http://somesite.com", dojox.io.xhrPlugins.fullHttpAdapter);
overrides the default xhr handler to implement a registry of xhr handlers