本文介绍了Microsoft Edge:XMLHttpRequest:网络错误 0x2efd,由于错误 00002efd,无法完成操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个单页的 html 和 Angularjs 文件.

App.js

角度.module('vod', []).controller('moviesController', ['$http', function ($http) {var self = this;self.movi​​es = [];$http.get('http://localhost:8080/movies/').then(function (response) {self.movi​​es = response.data;},函数(错误响应){console.error('获取电影时出错');});}]);

HTML

<头><title>Angular</title><script src="angular.min.js"></script><script src="app.js"></script><body ng-controller="moviesController as ctrl"ng-app="vod"><div ng-repeat="ctrl.movi​​es 中的电影"><span ng-bind="movie.title"></span>

</html>

它在 Chrome 上运行良好,生成电影标题但会出现错误
SCRIPT7002: XMLHttpRequest: Network Error 0x2, 系统找不到指定的文件

SCRIPT7002:XMLHttpRequest:网络错误 0x2efd,由于错误 00002efd,无法完成操作. 在 Microsoft Edge 上.

解决方案

有几个地方可能会出错.

尝试添加 Content-type: application/json;charset=utf-8 标头.

Edge 不喜欢 VPN 和混合网络.这对您来说可能不是这种情况,但很高兴知道.

更多阅读:

  1. SCRIPT7002:XMLHttpRequest:网络错误 0x2ef3,由于错误 00002ef3,无法完成操作

  2. 为什么 Microsoft Edge 打开某些本地网站,而不打开其他网站,其中域名路由到 hosts 文件中的 127.0.0.1

I have a single page html and Angularjs file.

App.js

angular
.module('vod', [])
.controller('moviesController', ['$http', function ($http) {
    var self = this;
    self.movies = [];
    $http.get('http://localhost:8080/movies/').then(function (response) {
        self.movies = response.data;
    }, function (errResponse) {
        console.error('Error while fetching movies');
    });
}]);

HTML

<!DOCTYPE html>
<html>
    <head>
        <title>Angular</title>
        <script src="angular.min.js"></script>
        <script src="app.js"></script>
    </head>
    <body ng-controller="moviesController as ctrl"
          ng-app="vod">
        <div ng-repeat="movie in ctrl.movies">
            <span ng-bind="movie.title"></span>
        </div>
    </body>
</html>

It works well on Chrome producing the movie titles but gives the errors
SCRIPT7002: XMLHttpRequest: Network Error 0x2, The system cannot find the file specified
and
SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 00002efd. on Microsoft Edge.

解决方案

There are several things which can go wrong.

Try adding the Content-type: application/json; charset=utf-8 header.

Edge does not like VPN and mixed networks. This is probably not the case for you, but good to know.

More to read:

  1. SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3

  2. Why does Microsoft Edge open some local websites, but not others, where the domain name is routed to 127.0.0.1 in hosts file

这篇关于Microsoft Edge:XMLHttpRequest:网络错误 0x2efd,由于错误 00002efd,无法完成操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 22:55
查看更多