A map of available XHR transport handle types. Name matches the handleAs
attribute passed to XHR calls.
A map of available XHR transport handle types. Name matches the handleAs
attribute passed to XHR calls. Each contentHandler is called, passing the xhr object for manipulation. The return value from the contentHandler will be passed to the load
or handle
functions defined in the original xhr call.
Creating a custom content-handler:
xhr.contentHandlers.makeCaps = function(xhr){
return xhr.responseText.toUpperCase();
}
// and later:
dojo.xhrGet({
url:"foo.txt",
handleAs:"makeCaps",
load: function(data){ /* data is a toUpper version of foo.txt */ }
});
auto
(xhr)
Defined by dojox/rpc/Service
Parameter | Type | Description |
---|---|---|
xhr | undefined |
javascript
(xhr)
Defined by dojo/_base/xhr
A contentHandler which evaluates the response data, expecting it to be valid JavaScript
Parameter | Type | Description |
---|---|---|
xhr | undefined |
Returns: undefined
json
(xhr)
Defined by dojo/_base/xhr
A contentHandler which returns a JavaScript object created from the response data
Parameter | Type | Description |
---|---|---|
xhr | undefined |
Returns: undefined
json-comment-filtered
(xhr)
Defined by dojo/_base/xhr
A contentHandler which expects comment-filtered JSON.
A contentHandler which expects comment-filtered JSON. the json-comment-filtered option was implemented to prevent "JavaScript Hijacking", but it is less secure than standard JSON. Use standard JSON instead. JSON prefixing can be used to subvert hijacking.
Will throw a notice suggesting to use application/json mimetype, as json-commenting can introduce security issues. To decrease the chances of hijacking, use the standard json
contentHandler, and prefix your "JSON" with: {}&&
use djConfig.useCommentedJson = true to turn off the notice
Parameter | Type | Description |
---|---|---|
xhr | undefined |
Returns: undefined
json-comment-optional
(xhr)
Defined by dojo/_base/xhr
A contentHandler which checks the presence of comment-filtered JSON and alternates between the json
and json-comment-filtered
contentHandlers.
Parameter | Type | Description |
---|---|---|
xhr | undefined |
Returns: undefined
text
(xhr)
Defined by dojo/_base/xhr
A contentHandler which simply returns the plaintext response data
Parameter | Type | Description |
---|---|---|
xhr | undefined |
Returns: undefined
xml
(xhr)
Defined by dojo/_base/xhr
A contentHandler returning an XML Document parsed from the response data
Parameter | Type | Description |
---|---|---|
xhr | undefined |
Returns: undefined
© 2005–2017 JS Foundation
Licensed under the AFL 2.1 and BSD 3-Clause licenses.
http://dojotoolkit.org/api/1.10/dojo/_base/kernel.contentHandlers.html