has been blocked by CORS policy: No ‘Access-Control-Allow-Origin‘ header is present on the requested

 Access to XMLHttpRequest at ‘http://xxx/user/getAll/1/1’ from origin ‘http://127.0.0.1:8080’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

网上找到一个方法:

大概就是,chrome安全策略的原因,chrome 禁止跨域策略(CORS policy) 

新建一个 禁止cors跨域相关的策略的 chrome,

1.桌面新建一个快捷方式:

has been blocked by CORS policy: No ‘Access-Control-Allow-Origin‘ header is present on the requested

“C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” –disable-web-security –disable-gpu –user-data-dir=~/chromeTemp

C:\Program Files (x86)\Google\Chrome\Application\chrome.exe ,为chrome的路径。

2.创建完成,使用该chrome访问即可。

 

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/ae9dfcb8e8.html