Contact emails
Spec
Summary
Chrome currently supports the Push API, but requires developers to display a Web Notification in response to incoming messages. This is done by enforcing the existence of a “gcm_user_visible_only” key in the site’s manifest file.
This is a proprietary and prefixed solution, which was discussed in our
previous Intent to Ship. Additionally, because we cannot access the manifest from within Service Workers, right now we have to assume that the developer’s intent is to only send push messages resulting in user visible UI.
We have introduced an optional dictionary having a “userVisible” key to the subscribe() method through which the developer can clarify their intent.
This key also allows us to explain the hasPermission() method accurately, which we therefore would like to ship.
Example
serviceWorkerRegistration.pushManager.subscribe({
userVisible: true
}).then(...);
serviceWorkerRegistration.pushManager.hasPermission().then(...);
Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes - minus Android WebView because we don’t support the Push API there.
Compatibility Risk
Small. We are the only ones who ship the Push API, and this is a specified iteration on our implementation. Implementations which do not care about the value of userVisible will ignore it.
The Permission API already supports this option in the Push permission descriptor. We acknowledge that the hasPermission() method presents some overlap for this API, but consider this to be OK because (1) the API footprint is very small, and (2) it allows existing users of Push to avoid introducing a dependency on the Permission API, which other UAs could choose to deliver independently of Push.
We plan to deprecate the “gcm_user_visible_only” manifest key and will show a warning in the developer console when this is used, but not the userVisible key. Chrome 45 will remove support for the manifest key altogether.
OWP launch tracking bug?
Link to entry on the feature dashboard
None.