HTML5-XMLHttpRequest Level 2

Source: Internet
Author: User

1. Overview
XMLHttpRequest Level 2 is an enhancement to XMLHttpRequest and supports cross-origin.

2. browser support Detection
If (typeof xhr. withcredentials === undefined)
{
Document. getelementbyid ("support"). innerhtml =
"Your browser <strong> doesnot </strong> support cross-origin XMLHttpRequest ";
}
Else
{
Document. getelementbyid ("support"). innerhtml =
"Your browser <strong> does </strong> support cross-origin XMLHttpRequest ";
}

3. New event name
before XMLHttpRequest Level 2, the status of the XMLHttpRequest request and response is represented by numerical values, similar to enumeration. XMLHttpRequest Level 2 uses Named events to replace different statuses of requests and responses. These named events have corresponding event attributes and can assign event processing functions to the event attributes of each event.
the XMLHTTPRequest object has some events, such as loadstart, progress, abort, error, load, upload, and loaded. These events can be considered as sub-objects of XMLHttpRequest, and they have some event attributes.
XMLHttpRequest itself has some event attributes and events. XMLHttpRequest event attributes include XMLHttpRequest. onprograss, XMLHttpRequest. onload, and XMLHttpRequest. onerror.
You can input a parameter E in the Program function of event processing. E has some attributes related to events and data information, e. total, E. loaded, E. uploaded, E. downloaded, E. lengthcomputable.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.