dojox/io/xhrPlugins (version 1.10)

See the dojox/io/xhrPlugins reference documentation for more information.

Property Summary

Method Summary

  • addCrossSiteXhr(url,httpAdapter) Adds W3C Cross site XHR or XDomainRequest handling for the given URL prefix
  • addProxy(proxyUrl) adds a server side proxy xhr handler for cross-site URLs
  • fullHttpAdapter(plainXhr,noRawBody) Provides a HTTP adaption.
  • register() overrides the default xhr handler to implement a registry of xhr handlers

Properties

plainXhr
Defined by: dojox/io/xhrPlugins

Methods

addCrossSiteXhr(url,httpAdapter)
Defined by dojox/io/xhrPlugins

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 <*>

see: http://www.w3.org/TR/access-control/

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.

addProxy(proxyUrl)
Defined by dojox/io/xhrPlugins

adds a server side proxy xhr handler for cross-site URLs

Parameter Type Description
proxyUrl undefined

This is URL to send the requests to.

Examples

Example 1

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
fullHttpAdapter(plainXhr,noRawBody)
Defined by dojox/io/xhrPlugins

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

Examples

Example 1

dojox.io.xhrPlugins.addXdr("http://somesite.com", dojox.io.xhrPlugins.fullHttpAdapter);

register()
Defined by dojox/io/xhrPlugins

overrides the default xhr handler to implement a registry of xhr handlers

Error in the documentation? Can’t find what you are looking for? Let us know!