Cross domain
What is homology
-
The source
To get the current source, type window.origin or location.orgin on any Web developer console
-
Source = Protocol + domain name + port number
Perfect agreement is homology
Origin Policy Definition
Different sources cannot access each other
CORS
Cross-domain resource sharing
Add the site to the shared server.js response header (exactly the same)
response.setHeader("Access-Control-Allow-Origin", "http://frank.com:9990")
Copy the code
JSONP
Create a script request js, put the data in the JS, and then get the JS
-
advantages
Compatible with IE
Cross domain
-
disadvantages
Because it’s a script tag, it doesn’t get the status code, it doesn’t get the header
It does not support POST, only GET