Cross-Domain Ajax

Source: Internet
Author: User
Tags script tag

Because the browser has a same-origin policy mechanism, the same-origin policy prevents a document or script loaded from one source from getting or setting the properties of another source-loaded document.

Special : Because the same-origin policy is the browser's limit, so the request send and response can be done, but the browser does not accept it.

Browser-origin policies are not restricted to all requests:

  • Restriction: XMLHttpRequest
  • No: IMG, iframe, script and other tags with src attributes

Cross-domain, cross-domain access, such as: http://www.c1.com domain names send requests to http://www.c2.com domains.

1. Jsonp for cross-domain requests

JSONP (Jsonp-json with padding is a "usage pattern" of JSON), using the SRC attribute of the script tag (the browser allows the script tag to cross the domain)

Cross-Domain Ajax

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.