--- title: PushMessageData.json() slug: Web/API/PushMessageData/json tags: - PushMessageData.json() translation_of: Web/API/PushMessageData/json ---
{{APIRef("Push API")}}{{SeeCompatTable()}}
{{domxref("PushMessageData")}} 接口的 json()
方法将推送消息数据提取为 一个 JSON 对象。
let massage_Json = PushEvent.data.json();
None.
A JSON object.
self.addEventListener('push', function(event) { var jsonObj = event.data.json(); // do something with your JSON });
Specification | Status | Comment |
---|---|---|
{{SpecName('Push API', '#widl-PushMessageData-json-JSON', 'json()')}} | {{Spec2('Push API')}} | Initial definition. |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | {{CompatChrome(50.0)}} | {{CompatGeckoDesktop(44.0)}}[1] | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | {{CompatNo}} | {{CompatNo}} | {{CompatGeckoMobile(48)}}[2] | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatChrome(50.0)}} |