Skip to content
Web Monetization logo Web Monetization
GitHub

onmonetization event handler

HTML DOM API

By creating an onmonetization event handler, your web page can programmatically respond to monetization events.

window.onmonetization

The onmonetization event handler is used by the Web Monetization agent to process monetization events sent to the browser window (the event target).

The onmonetization property can be applied to any element and is used by the browser to notify that some <link> element is monetized.

In a tabbed browser, each tab is represented by its own window object.

Syntax

window.onmonetization=functionRef

Where functionRef is the event handler function to execute when a monetization event fires.

Example

Show a message to site visitors to let them know that your page supports Web Monetization.

<script type="text/javascript">
window.onmonetization = function () {
alert('This page supports Web Monetization.')
}
</script>

// ## Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Internet Explorer
Opera
Safari
WebView Android
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
Puma Browser
onmonetization
Yes Yes Yes No Yes No No No No No No No Yes
Full Support
No Support
You'll need to use a Web Monetization Extension

Specifications