What is cross-domain?
Why do browsers want to restrict cross-domain?
The above questions are described in more detail and not described in the relevant blog.
What problems have been brought about?
I again 8097 Port want to access 8090 of static resources (fonts or CSS, etc.) is forbidden.
How to solve these problems?
1, Jsonp method, in fact, is the <script> tag src http request to get JSON format data, and then use JavaScript function for processing.
HTTPS://www.cnblogs.com/2050/p/3191744.html
In the Baidu Encyclopedia also said is also very detailed
HTTPS://baike.baidu.com/item/jsonp/493658
Note: The above JSONP if you want to direct $.ajax ({URL:}) that is XMLHttpRequest object to get data from other domains is not possible, this is called prohibit cross-domain. (Of course, this forbidden action is done by the browser)
2, the second method, is to tell the browser this domain name can be cross-domain,
CORS(Cross-Origin Resource Sharing
The main use of this, that is, through the HTTP header server to communicate with the browser,
Server-side CORS
support, mainly through the setup Access-Control-Allow-Origin
to do. If the browser detects the appropriate settings, it can allow Ajax for cross-domain access.
Header ("access-control-allow-origin: *");
Do not know why in the project entrance file index.php write this useless, the browser still give you banned
Related reading recommendations:
HTTPS://www.cnblogs.com/yongshaoye/p/7423881.html
JavaScript cross-domain