0

For example, I want to render some NFTs that have urls like this:

ipfs://QmZ5fD3UTRh8ALZCpMdypHkhMQSXyi4yyCz3Ea19kPmtXg/0.jpg

but when I try to fetch this uri in my react app, I get this error:

GET ipfs://QmZ5fD3UTRh8ALZCpMdypHkhMQSXyi4yyCz3Ea19kPmtXg/0.jpg net::ERR_UNKNOWN_URL_SCHEME

How can I fix this?

1 Answer 1

0

Not all tools, browsers, etc. support fetching IPFS content.

In general, there are a couple of options for you to load IPFS content:

1. Use a browser that supports IPFS links

  • Brave browser started supporting IPFS in version 1.19
  • Opera launched IPFS support in Feb 2021

By installing one of these browsers, typing your IPFS uri into the search bar should load the resource.

2. Use a public IPFS gateway

Public gateways route your IPFS request through an HTTP server. So doing something like https://gateway.pinata.cloud/ipfs/bafybeie7tfuh4fkcp27xfrpftly732kjrr6ioj7ypa45ilv7lhpsadykh4/0.jpg would show your image.


In your case, since you are programmatically fetching content, you can parse the hash and append a public gateway url prefix to fetch the images.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.