Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/immers-space/web-monetization-polyfill
Polyfill the Web Monetization JavaScript API on document.monetization
https://github.com/immers-space/web-monetization-polyfill
Last synced: about 1 month ago
JSON representation
Polyfill the Web Monetization JavaScript API on document.monetization
- Host: GitHub
- URL: https://github.com/immers-space/web-monetization-polyfill
- Owner: immers-space
- License: apache-2.0
- Created: 2020-11-06T03:42:53.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-06T16:27:31.000Z (almost 4 years ago)
- Last Synced: 2024-11-04T01:03:16.494Z (about 1 month ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-web-monetization - web-monetization-polyfill - Ensure the JavaScript Web Monetization API is available, even in environments with Content Security Policies enabled. ![](assets/small_icons/javascript.png) (Resources / Packages)
README
# web-monetization-polyfill
[![npm](https://img.shields.io/npm/v/web-monetization-polyfill)](https://www.npmjs.com/package/web-monetization-polyfill)
Polyfill the [Web Monetization JavaScript API](https://webmonetization.org/docs/api)
on `document.monetization`## Why
The [Coil browser extension](https://help.coil.com/using-coil/coil-extension)
will typically load the polyfill for you, but,
if you're serving your page with a Content Security Policy, the extension will
be unable to inject the polyfill script.In that case, you'll want to provide the `web-monetization-polyfill` yourself.
## Usage
Install: `npm install web-monetization-polyfill`
Source: `require('web-monetization-polyfill')`
While you could, in theory, source this from a CDN in a script tag,
you'd have to open up your CSP to allow it, so this method is not recommended.
If you must, you'll need to add the [current hash](hash.txt) to your `script-src` directive.## Compatibility
web-monetization-polyfill | Coil browser add-on
--- | ---
2.0.0 | 0.0.52## Copyright
Copyright for the original source for the polyfill belongs to [Coil](https://github.com/coilhq/web-monetization-projects)