Fetch

A window.fetch JavaScript polyfill.

README

window.fetch polyfill


The fetch() function is a Promise-based mechanism for programmatically making
web requests in the browser. This project is a polyfill that implements a subset
of the standard [Fetch specification][], enough to make fetch a viable
replacement for most uses of XMLHttpRequest in traditional web applications.

Table of Contents


  HTML
  JSON

Read this first


If you believe you found a bug with how fetch behaves in your browser,
  please don't open an issue in this repository unless you are testing in
  an old version of a browser that doesn't support window.fetch natively.
  Make sure you read this _entire_ readme, especially the Caveats
  section, as there's probably a known work-around for an issue you've found.
  This project is a _polyfill_, and since all modern browsers now implement the
  fetch function natively, no code from this project actually takes any
  effect there. See Browser support for detailed
  information.

If you have trouble making a request to another domain (a different
  subdomain or port number also constitutes another domain), please familiarize
  yourself with all the intricacies and limitations of [CORS][] requests.
  Because CORS requires participation of the server by implementing specific
  HTTP response headers, it is often nontrivial to set up or debug. CORS is
  exclusively handled by the browser's internal mechanisms which this polyfill
  cannot influence.

This project doesn't work under Node.js environments. It's meant for web
  browsers only. You should ensure that your application doesn't try to package
  and run this on the server.

If you have an idea for a new feature of fetch, submit your feature
  requests to the specification's repository.
  We only add features and APIs that are part of the [Fetch specification][].

Installation


  1. ```
  2. npm install whatwg-fetch --save
  3. ```

As an alternative to using npm, you can obtain fetch.umd.js from the
[Releases][] section. The UMD distribution is compatible with AMD and CommonJS
module loaders, as well as loading directly into a page via `