Ajax-xmlhttprequest and Local files

Source: Internet
Author: User

The ability to use relative URLs in Web pages often means that we can use the local file system to develop and test HTML and avoid unnecessary deployment of Web servers.

However, this is usually not possible when using XMLHttpRequest for AJAX programming.

the XMLHttpRequest is used to work with HTTP and HTTPS protocols . Theoretically, it can work with other protocols such as FTP, but some APIs, such as request methods and response status codes, are specific to HTTP. If you load a Web page from a local file, the scripts in that Web page will not be able to use XMLHttpRequest with relative URLs, because these URLs will be relative to File://URL instead of Http://URL. The same- origin policy usually prevents the use of absolute http://URL. The result is that when using XMLHttpRequest, it is often necessary to upload files to the Web server or run a local server in order to test them.

Ajax-xmlhttprequest and Local files

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.