PushSubscription: endpoint プロパティ
Baseline 2023Newly available
Since March 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
endpoint
は PushSubscription
インターフェイスの読み取り専用プロパティで、プッシュサブスクリプションに関連するエンドポイントの入った文字列を返します。
エンドポイントはカスタム URL の形式を取り、プッシュサービスに加入している特定のサービスワーカーにプッシュメッセージを送信するために使用するプッシュサーバーを指します。このため、他者がこれをハイジャックしてプッシュ機能を乱用しないように、エンドポイントは秘匿しておくことが大切です。
値
文字列です。
例
js
navigator.serviceWorker.ready.then((reg) => {
reg.pushManager.subscribe({ userVisibleOnly: true }).then((subscription) => {
console.log(subscription.endpoint);
// この時点で、サブスクリプションエンドポイントをサーバーに送信し、
// 保存した後、後でプッシュメッセージを送信するために使用します。
});
});
仕様書
Specification |
---|
Push API # dom-pushsubscription-endpoint |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
endpoint |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.