About cross-domain issues with angular.js request data

Source: Internet
Author: User

-Generally the cross-domain exists only on the browser that has this problem. 
-If you encounter cross-domain issues
+ 1. Accept data forwarding via your own server (the following methods are not secure)
+ 2. In the sender's request header, add: Access-control-allow-origin: * (side server support)
+ 3. Send data via JSONP (JSONP is just a data format) (offset server support)
-What is Jsonp
Jsonp (JSON with Padding) is a "usage pattern" of JSON that allows Web pages to fetch data from other domain names (sites), that is, across domains.
Why do we need a special technology (JSONP) to access data from different domains (websites)? This is because of the homologous policy.
The same-origin policy, which is a well-known security policy presented by Netscape, is now used by all JavaScript-enabled browsers.
-If the customer wants to visit: http://www.itcast.com/jsonp.php?jsonp=callbackFunction.
Suppose the customer expects to return JSON data: ["customername1", "customername2"].
the data that is actually returned to the client is displayed as: Callbackfunction (["Customername1", "customername2"]).

About cross-domain issues with angular.js request data

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.