V
V
Vadim V2019-08-17 22:12:12
JavaScript
Vadim V, 2019-08-17 22:12:12

How to enable fetch support in internet explorer?

Need fetch support in IE... Googled, put polyfills and nothing helped. I get this error all the time 5d585246bf6e0775483633.jpeg. The following response comes in response 5d58523ca347e141218124.jpeg. That is, in response.body - undefined. How to be? Everything works fine in Chrome and Firefox

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dima Polos, 2019-08-19
@reyzele

function myFetch(params){
    return new Promise(function(resolve, reject){
       const xhr = new XMLHttpRequest();
        xhr.open(params.method, params.url, true);
        xhr.send();
        xhr.addEventListener('readystatechange', function(e){
              if( xhr.readyState != 4  ) return;
              if( xhr.status == 200 ){
                   resolve( xhr.responseText );
               } else{ reject( xhr.statusText ); }
        });
}
myFetch(//parameters...).then(//...... код который у Вас в then).

A
Anatoly Chernyshev, 2019-08-17
@kayn23

The issue is solved by polymorph
https://github.com/github/fetch

G
grinat, 2019-08-19
@grinat

Are you trying to save a file? ie has truncated save support, you need to do it through save file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question