![](/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.