You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Taku AMANO edited this page Aug 28, 2013
·
3 revisions
Implementation notes
Sending POST request
If the FormData object is available in browser, the DataAPI object sends request body by using the FormData object. As a result, all the POST requests are sent with "multipart/form-data".
If the FormData object is not available in browser, the DataAPI object sends request body with "application/x-www-form-urlencoded".
Avoiding browser cache
If "cache" option is true, the DataAPI sends GET/POST request simply.
If "cache" option is false, the DataAPI sends GET/POST request with the "_" parameter. The value of the "_" parameter is the current timestamp (microsecond).
Sending request in the cross-origin environment. (CORS)
If "crossOrigin" option is true or a DataAPI object detect current environment is cross-origin by document's URL and baseUrl, a DataAPI object sends request by settings of cross-origin. The following behaviors are changed.
(If you want to do cross-orign request, you need to add DataAPICORSAllowOrigin to mt-config.cgi.)
X-Requested-With request header
A DataAPI object sends a request with "X-Requested-With" header in same-origin environment.
But in cross-origin environment, sends a request without "X-Requested-With" header.
Using XDomainRequest for IE8 and IE9
Since A XMLHttpRequest object of IE8 and IE9 can not send request in cross-origin environment, A DataAPI object sends a request useing a XDomainRequest object.
A XDomainRequest object cannot set custom request header. Therefore, the request that requires authentication cannot be sent. (If you try to send that request, a DataAPI object throws exception.)