Skip to content

Commit 0d6167e

Browse files
Merge pull request #582 from ipfs/docs/asset-addressing
docs: add example to protocol upgrade
2 parents 38652fc + 1586c2c commit 0d6167e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/how-to/address-ipfs-on-web.md

+18
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@ HTTP gateways have worked well since 2015, but they come with a significant set
3030

3131
Tools and browser extensions should detect IPFS content paths and resolve them directly over IPFS protocol. They should use HTTP gateway only as a fallback when no native implementation is available in order to ensure a smooth, backward-compatible transition.
3232

33+
::: tip
34+
35+
Use relative or absolute URLs that include content-addressed paths. This will take advantage of content addressing today while ensuring backward compatibility with the legacy web.
36+
37+
For example, a website can load static assets from content-addressed paths:
38+
39+
```
40+
<link rel="stylesheet" href="https://example.com/ipfs/QmNrgEMcUygbKzZeZgYFosdd27VE9KnWbyUD73bKZJ3bGi?filename=style.css">
41+
```
42+
43+
```
44+
<link rel="stylesheet" href="/ipfs/QmNrgEMcUygbKzZeZgYFosdd27VE9KnWbyUD73bKZJ3bGi?filename=style.css">
45+
```
46+
47+
Browsers that support IPFS will recognize the `/ipfs/<CID>` content path and load the related asset over IPFS instead of HTTP.
48+
User agents without IPFS support still get the correct data from the original HTTP server.
49+
:::
50+
3351
### Path gateway
3452

3553
In the most basic scheme, a URL path used for content addressing is effectively a resource name without a canonical location. The HTTP server provides the location part, which makes it possible for browsers to interpret an IPFS content path as relative to the current server and just work without a need for any conversion:

0 commit comments

Comments
 (0)