Fetch: Error: Promise undefined ?

Created on 26 May 2016  路  3Comments  路  Source: github/fetch

I get a "'Promise' is undefined"-error on Internet Explorer 11. I imported whatwg-fetch but it seems like the polyfill wont be found. Or is there something I'm missing?

import 'whatwg-fetch';

return fetch(url)
    .then(function (response) {
      return response.json();
    }).then(function (json) {
      return json;
    }).catch(function (ex) {
      console.log('failed:' + ex);
    }); 

Most helpful comment

This seems like a good thing to include in documentation.

This library is fantastic, but I long for better documentation.

All 3 comments

Make sure you have a Promise polyfill, as IE 11 doesn't support Promises out of the box. I'd recommend es6-promise.

This seems like a good thing to include in documentation.

This library is fantastic, but I long for better documentation.

The library states:

You'll also need a Promise polyfill for older browsers.

$ bower install es6-promise

Additionally, this is a current web standard. Documentation is available in other places too; this is just a polyfill.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gkatsanos picture gkatsanos  路  4Comments

javan picture javan  路  3Comments

shirotech picture shirotech  路  3Comments

poppinlp picture poppinlp  路  4Comments

AllenFang picture AllenFang  路  5Comments