PushMessageData: text()-Methode
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.
Sicherer Kontext: Diese Funktion ist nur in sicheren Kontexten (HTTPS) in einigen oder allen unterstützenden Browsern verfügbar.
Hinweis: Diese Funktion ist nur in Service Workers verfügbar.
Die text()
-Methode der PushMessageData
-Schnittstelle extrahiert Push-Nachrichtendaten als einfachen Textstring.
Syntax
js
text()
Parameter
Keine.
Rückgabewert
Ein String.
Beispiele
js
self.addEventListener("push", (event) => {
const textObj = event.data.text();
// do something with your text
});
Spezifikationen
Specification |
---|
Push API # dom-pushmessagedata-text |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
text |
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.