簡體   English   中英

在AngularJS的IE11上拒絕訪問

[英]Access is Denied on IE11 in AngularJS

每個開發管道都有2個部分。 首先要努力工作並開發應用程序。 第二,努力工作,使其與出色的IE兼容。

我們有一個AngularJS (v1.3.13)應用程序,沒有在Webstorm開發任何服務器端代碼。 我們正在進行REST服務調用。 我們的應用程序在Chrome和Firefox上運行正常,沒有任何控制台錯誤。 但是,當我們嘗試在IE11或IE9中打開頁面(未嘗試IE10)時,我們的頁面無法加載。 控制台提示我們有2個錯誤。 其中之一Access is Denied

xhr.open(method, url, true);

angular.js

互聯網上的帖子數量很多,似乎都沒有作用。 這就是我嘗試過的。

  1. 使用更改后的處理程序映射在IIS托管應用程序,以支持.Net v4.0應用程序池上的跨域調用(由資深人員建議)
  2. 嘗試禁用緩存HTTP請求。
  3. 在受信任的站點類別中添加域,還將locahost / IP添加到本地Intranet。
  4. 將請求類型更改為JSONP並嘗試將Access-Control-Allow-Origin (值為* )添加到標頭中。
  5. 更改IE設置以允許跨域調用。

錯誤仍然在追逐着我們。 即使是我的同事,也曾在他們的機器上嘗試過相同的操作,但結果卻受到類似的打擊。 有沒有人給我建議呢?

可能是CORS,我可能需要使用xdr(XDomainRequest),但不確定如何使用它,因為angular.js中存在錯誤。 我當然不是專家,所以請提出建議。

錯誤的屏幕截圖: 在此處輸入圖片說明

IE顯示另一個錯誤: [$injector:nomod] Module 'ngLocale' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.2.16/$injector/nomod?p0=ngLocale [$injector:nomod] Module 'ngLocale' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.2.16/$injector/nomod?p0=ngLocale [$injector:nomod] Module 'ngLocale' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.2.16/$injector/nomod?p0=ngLocale我現在忽略了。

請給我一些建議。 謝謝。

我從1.3.4切換到1.4.8,就成功了。 IE中不再拒絕Angular Access(Microsoft Edge 25 2015)。 我不知道為什么

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-route.js/1.4.8/angular.min.js"></script>

在AngularJS的IE11上訪問被拒絕錯誤在此鏈接上有一個解決方案我從IE11下載圖像時也遇到了相同的錯誤。 我剛剛在代碼中添加了以下代碼,它可以正常工作。

window.navigator.msSaveBlob(blob, paramDataObject.fileName); 
or
window.navigator.msSaveOrOpenBlob(blob, paramDataObject.fileName);

您是否嘗試過xdomain? https://github.com/jpillora/xdomain,它是純JavaScript CORS替代方案。

if (window.navigator && window.navigator.msSaveOrOpenBlob) {   
   window.navigator.msSaveOrOpenBlob(blob);
}
else {   
   var objectUrl = URL.createObjectURL(blob);    
   window.open(objectUrl);
}

在AngularJS中設置window.location或window.open會在IE 11中提供“訪問被拒絕”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM