Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

javascript - Microsoft Edge: XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 00002efd

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...