![](/img/trans.png)
[英]IE: “Origin not found in Access-Control-Allow-Origin header” using CORS enabled .NET Core and Angular 2
[英]Chrome / IE, AngularJS, and Access-Control-Allow-Origin
我正在AngularJS中构建一个可以通过CD分发的Web应用程序,但我分别使用Chrome和IE的原始策略打了一个砖墙:
XMLHttpRequest cannot load file:///xxx. Origin null is not allowed by Access-Control-Allow-Origin.
有什么方法可以通过代码或其他方式绕过这个吗?
我使用的解决方案是通过<script type="text/ng-template">
指令在index.html
文件中内联定义所有模板,如下所示:
<script type="text/ng-template" id="/template.html">
<h1>I'm the content</h1>
</script>
<ng-include src="/template.html"></ng-include>
是的,你可以
delete $http.defaults.headers.common['X-Requested-With'];
在请求之前
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.