This repository has been archived by the owner on Jul 30, 2022. It is now read-only.
Supporting link[rel=monetization] #3
Labels
documentation
Improvements or additions to documentation
Based on WICG/webmonetization#19, I decided to implement
<link rel="monetization">
instead of<meta name="monetization">
as the "monetization element". The content in monetization element represents the payment pointer - a meta-data URL where to send the money to. More precisely, the payment pointer is a pointer - it needs to be fetched to get a destination account and a shared secret, where money is actually sent with ILP. By making using of the<link>
element, we get some additional benefits, as described in WICG/webmonetization#19 (comment).Following are the behavioral requirements from the
link[rel=monetization]
element:Observable Mechanics
Based on our current understanding, we want a document/window/tab to have only a single payment stream. We make use of only the first valid monetization element at any time.
If the document is hidden, abort.
On initial page load, set the active monetization element (
activeEl
) to the first valid monetization element.If a monetization element (
el
) is added to the<head>
later on:activeEl
, setactiveEl
toel
.el
is appended to the<head>
, do nothing.el
is added beforeactiveEl
, setactiveEl
toel
.Fetch and Process steps for
activeEl
Fetch(activeEl, bypassCache = false)
Fetch the content at
activeEl.href
as per the SPSP spec:monetization-src
CSP directive.Cache-control
HTTP headers unless bypassCache is true.Process(spspResponse)
Implementation in Firefox
For the basic "support", i.e.,
HTMLLinkElement.relList.supports("monetization")
, see 43780b6The Firefox implementation is written in JSM and makes use of
JSWindowActor
APIs. There can be some difficulties if one were to write it in C++ - specially due to the observable mechanics that I discussed above (along with the ability to manually request a re-fetch multiple times later). Additional details are explained in #4.The text was updated successfully, but these errors were encountered: