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 */ }
});
A contentHandler which evaluates the response data, expecting it to be valid JavaScript
| Parameter | Type | Description |
|---|---|---|
| xhr | undefined |
A contentHandler which returns a JavaScript object created from the response data
| Parameter | Type | Description |
|---|---|---|
| xhr | undefined |
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 |
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 |
A contentHandler which simply returns the plaintext response data
| Parameter | Type | Description |
|---|---|---|
| xhr | undefined |
A contentHandler returning an XML Document parsed from the response data
| Parameter | Type | Description |
|---|---|---|
| xhr | undefined |