A 6KB JavaScript plugin for the Instagram API (without jQuery).

By Thomas Vaeth (and Brian Hague).

Download on GitHub

Why this plugin?

No jQuery. Why use an 87KB file only to write more JavaScript that is only being used for AJAX to return some JSONP? Let's use fetch instead. Instafetch.js is a 6KB file that returns your Instagram feed with the option of including captions.

How to Use

The Instagram API uses the OAuth 2.0 protocol, so you're going to need an access token. The easiest way to get your access token is login to Instagram on your browser and generate one on Pixel Union.

  accessToken: 'ACCESS TOKEN',
  target: 'instafetch',
  numOfPics: 20,
  caption: false

Instafetch.js will look for an element with the ID of instafetch by default. The target element can be changed when initializing the plugin.

The plugin also allows you to set the number of items to return from your feed and if you want to include the captions.

Promise Polyfill

Instafetch.js was only 3KB initially, but those 3KB didn't support any version of Internet Explorer. IE will return "Promise is undefined" and the Instagram feed will be empty. Version 1.2 included the ES6-Promise polyfill, which added an extra 7KB just for IE. Version 1.3 removed the ES6-Promise polyfill for another Promise polyfill that only added 3KB.

Download on GitHub

(Or Contribute)