Wishlist: window.ipfs.location #602
Labels
area/window-ipfs
Issues related to IPFS API exposed on every page
kind/enhancement
A net-new feature or improvement to an existing feature
status/deferred
Conscious decision to pause or backlog
Milestone
So I'm a web extension developer, and I want a JavaScript accessible equivalent of the
X-Ipfs-Location
HTTP response header. While extensions can read this header, it requires a lot of extra work to parse this header compared to reading the location of a normal web accessible resource (window.document.location
.)No permission should be required to read data from this object as it's just there to encourage developers not to try and parse and make wild guesses from the
document.location
.Object:
window.ipfs.location
window.ipfs.location.nurl
, containing the IPFS NURL of the resource inwindow.document
window.ipfs.location.public_http_gateway
, a version of the nurl prefixed with a public gateway.This is useful for extensions that work with web services that need a web accessible way to access the resource (like the public HTTP gateway). E.g. extensions that save bookmarks to a web service, or share links to a social networks, or otherwise expects a normal URL.
Edit: Example of what an extension would have to do to make a best guess at what a public gateway address would look like for a resource on IPFS:
https://github.com/da2x/instapaper-webextension/blob/87df338a7af6ae303c17a1e37ea5ec9ed721b755/scripts/inject.js#L106-L131
The text was updated successfully, but these errors were encountered: