Skip to content
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

Open
pp-koch opened this issue Dec 8, 2021 · 12 comments
Open

General 'web monetization is/is not supported' message needed #246

pp-koch opened this issue Dec 8, 2021 · 12 comments
Labels
documentation All content related issues. For functionality issues, use the `website` tag specification Work required on specification

Comments

@pp-koch
Copy link

pp-koch commented Dec 8, 2021

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
}

@sublimator
Copy link
Collaborator

Something else I pondered might warrant Return of the Monetization is some kind of field to do provider attestation ...
but then I wondered if that could just be a field on the monetization event ?

@sublimator
Copy link
Collaborator

@marcoscaceres
Copy link
Contributor

A developer can now check: if ("MonetizationEvent" in window) instead of navigator.

@pp-koch
Copy link
Author

pp-koch commented Dec 9, 2021

Ugly. But it works. This is something that has to be improved in the next version.

@marcoscaceres
Copy link
Contributor

marcoscaceres commented Dec 15, 2021

Alternative:

var link = document.querySelector("link[rel='monetization']")
      || document.createElement("link");
if (link.relList.supports("monetization")) {
  // ...supported... 
} 

@sublimator
Copy link
Collaborator

sublimator commented Dec 15, 2021 via email

@marcoscaceres
Copy link
Contributor

Oops, copy/pasta

@marcoscaceres
Copy link
Contributor

Fixed

@sublimator
Copy link
Collaborator

So that would need to be gorilla glued in the coil extension too I guess

@pp-koch
Copy link
Author

pp-koch commented Dec 16, 2021

Yes. Right now it doesn't work with the CoilPreview 0.0.72 extension: it always returns false.

@pp-koch
Copy link
Author

pp-koch commented Jan 12, 2022

About (link.relList.supports("monetization")) as a feature detection ...

IF a browser natively supports web monetization
BUT the user is not signed in to any payment provider
will this return true or false?

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 ...

@huijing huijing added specification Work required on specification documentation All content related issues. For functionality issues, use the `website` tag labels Jun 27, 2023
@huijing huijing moved this to Todo in Web Monetization Jul 6, 2023
@AlexLakatos
Copy link
Collaborator

AlexLakatos commented Aug 23, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation All content related issues. For functionality issues, use the `website` tag specification Work required on specification
Projects
None yet
Development

No branches or pull requests

5 participants