-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
General 'web monetization is/is not supported' message needed #246
Comments
Something else I pondered might warrant |
A developer can now check: |
Ugly. But it works. This is something that has to be improved in the next version. |
Alternative: var link = document.querySelector("link[rel='monetization']")
|| document.createElement("link");
if (link.relList.supports("monetization")) {
// ...supported...
} |
manifest?
|
Oops, copy/pasta |
Fixed |
So that would need to be gorilla glued in the coil extension too I guess |
Yes. Right now it doesn't work with the CoilPreview 0.0.72 extension: it always returns false. |
About (link.relList.supports("monetization")) as a feature detection ... IF a browser natively supports web monetization I assume we can't tell yet, but if we use this line as a general feature detection and it starts to misbehave later we have a problem ... |
The "browser" related checks (MonetizationEvent, relList) tell a page that the User Agent (browser or extension) supports monetization, but not if the User is Web Monetized (has a Web Monetization provider / payment pointer and can pay). The triggering of the load event on the link is what informs the page that the User is Web Monetized. And that's because if the User Agent doesn't have a way to pay, it won't process the payment pointer found on the page. |
So I wrote a really simple example script that plays a video and shows premium content onmonetization. https://quirksmode.org/coil/testsuite/example-script.html
Requires CoilPreview 0.0.70. Only one is supported here, so wait for the video to play, then use the button to move the link tag.
One conclusion is obvious: we MUST have a simple way for the web developer to figure out immediately if web monetization is possible at all.
If it isn't there should be a message 'Enabled web monetization to view video' or something. That text is not a default placeholder, though: if monetization IS supported but not yet running nothing should happen.
So we need a replacement for
if (!navigator.monetization) {
// monetization not supported
}
The text was updated successfully, but these errors were encountered: