PushMessageData.json()
Baseline 2023
Newly available
Since March 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
PushMessageData
接口的 **json()
**方法将推送消息数据提取为 一个 JSON 对象。
Syntax
js
let massage_Json = PushEvent.data.json();
Parameters
None.
Returns
A JSON object.
Examples
js
self.addEventListener("push", function (event) {
var jsonObj = event.data.json();
// do something with your JSON
});
Specifications
Specification |
---|
Push API # dom-pushmessagedata-json |
Browser Compatibility
BCD tables only load in the browser