Do front-end, with Ajax to get data, is often the case, the same domain naturally no problem, if it is different domain to obtain data, the browser has a homologous policy restrictions.
Origin * isn't allowed by access-control-allow-origin
Some people will say with JSONP. If the data interface in the background only returns pure JSON data, it is not possible to modify the data form that conforms to JSONP. What shall we do at this time? If your browser is chrome, then there's the gospel. After opening the address of Chrome --args --disable-web-security , you can block secure access [--args: This parameter is optional], and then randomly invoke the data under different domains.
The following are the steps:
One: Chrome under Windows System (WIN7)
1. Close all open chrome. ( important ). Otherwise, there will be no effect!
2, create a shortcut to Chrome, the goal of modifying the shortcut is:
"C:\Program Files\google\chrome\application\chrome.exe"--args--disable-web-security
3. Double-click the Chrome shortcut we created to open chrome and " you're using an unsupported command line tag:--disable-web-security." Stability and security will decrease ", indicating that you have canceled the cross-domain limit, and you can call data across domains arbitrarily.
Mac OS under
/applications/google\ chrome.app/contents/macos/google\ Chrome--disable-web-security
Or
Open-a "Google Chrome"--args--disable-web-securityubuntu? Linux:
Chromium-browser--disable-web-security Open the Apple Safafi with the command line: (Mac OS)
Open-a '/applications/safari.app '--args--disable-web-security
Chrome browser cross-domain and security access issues using Chrome's command line tag: disable-web-security parameter inline data