简体   繁体   English

AngularJS-跨组织请求错误

[英]AngularJS - Cross Orgin Requests error

Try to read a local file. 尝试读取本地文件。 Get the following error. 得到以下错误。 I've tried all the Angular CORS tricks. 我已经尝试了所有Angular CORS技巧。 But no luck any ideas what I'm doing wrong. 但是,没有任何想法可以解决我的错。 Should work 应该管用

XMLHttpRequest cannot load file:///C://www/mapping.json. XMLHttpRequest无法加载file:/// C://www/mapping.json。 Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https, chrome-extension-resource. 跨源请求仅支持以下协议方案:http,数据,chrome-extension,https,chrome-extension-resource。

var App = angular.module('Search', ['ngResource', 'ionic'])
         .config(function ($httpProvider) {
             $httpProvider.defaults.useXDomain = true;
             delete $httpProvider.defaults.headers.common['X-Requested-With'];
         });


  var x = $http.get('mapping.json');

CORS required server side header: Access-Control-Allow-Origin CORS必需的服务器端标头:Access-Control-Allow-Origin

not sure how that works with plain files, 不知道如何处理普通文件,

please see for more info: http://enable-cors.org/ 请参阅更多信息: http : //enable-cors.org/

Maybe you have a file permission error and you don't have the rights to read the file. 也许您有文件许可权错误,但是您无权读取文件。 Try changing the permissions of that folder 尝试更改该文件夹的权限

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google Chrome浏览器中API调用的跨域错误 - Cross orgin error in google chrome for the api call AngularJS-跨源请求被阻止 - AngularJS - Cross Origin Requests Blocked 错误消息“ XMLHttpRequest无法加载。 跨源请求仅在AngularJS中支持HTTP - Error message 'XMLHttpRequest cannot load. Cross origin requests are only supported for HTTP in AngularJS' 对于来自AngularJS的跨域请求,Symfony2返回状态为-1的空错误 - Symfony2 return empty error with status -1 for cross-domain requests from AngularJS AngularJS错误:仅支持协议方案的跨源请求:http,数据,chrome扩展,https - AngularJS Error: Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https AngularJS错误跨源请求仅支持以下协议方案:http,数据,chrome,chrome扩展名,https,chrome-extension-resource - AngularJS error Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource 仅HTTP支持AngularJS 1.2跨源请求 - AngularJS 1.2 cross origin requests are only supported for HTTP 使用$ http服务的AngularJS跨域请求 - AngularJS cross-domain requests using $http service AngularJs中具有授权的跨域错误 - Cross-Origin error with Authorization in AngularJs angularjs 1.2.6跨源请求错误 - cross origin request error with angularjs 1.2.6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM