Skip to content

Latest commit

 

History

History
24 lines (16 loc) · 1.12 KB

README.md

File metadata and controls

24 lines (16 loc) · 1.12 KB

nftstorage-service-worker

A service worker to fetch content from IPFS via nftstorage.link or a fallback gateway if it ever gets blocked.

nftstorage.link is a fast IPFS gateway. Sometimes the entire domain gets completely blocked by Google Safe Browsing, which leaves sites that link to it unable to get their content. This service worker fixes that by trying to fetch the content via nftstorage.link first, and if there is an error, fetching from alternate IPFS gateways instead. FAST & ROBUST!

Getting started

  • Copy nftstorage-sw.js into the root of your static website project.
  • Register the service worker from a script tag or your main js bundle.
if ('serviceWorker' in navigator) {
  navigator.serviceWorker.register('nftstorage-sw.js');
}

Use with Webpack

For using nftstorage-service-worker on your project bundle with webpack, look into webpack example.

References