Optional call. If data is null, ?.json() yields undefined.
Object fallback.?? {} gives a safe empty object.
Field fallbacks.?? fills title and count when missing.
Compatibility
Browser Support
PushEvent.data is marked Baseline Widely available on MDN (since March 2023). Requires a secure context and a service worker. Not available in Internet Explorer.
✓ Baseline · Widely available
PushEvent.data
Read push payloads in modern browsers via service workers.
96%Core tag support
ChromeYes
Full support
EdgeYes
Full support
FirefoxYes
Full support
Safari18+
Push API maturity varies by OS
OperaYes
Full support
HTML element100% supported
Bottom line: Guard for null, prefer event.data?.json() ?? {}, and test on HTTPS.
Frequently Asked Questions
A read-only PushMessageData object with the bytes sent to the PushSubscription, or null if the push had no data member (MDN).
No. MDN marks PushEvent.data as Baseline Widely available (since March 2023). It is not Deprecated, Experimental, or Non-standard.
Only in a service worker push handler (secure context). It is not available on the main window thread.
text(), json(), arrayBuffer(), blob(), and bytes(). Unlike Fetch body readers, MDN says these methods can be called more than once on the same object.
When no payload was included - often called a silent push, which can wake the worker without user-visible content.
Use optional chaining and a fallback: const data = event.data?.json() ?? {}; then read fields with defaults like data.title || "Default".