Search code examples
google-chromegoogle-chrome-appservice-workerweb-pushpush-api

chrome.gcm is only available to apps and extensions, how do I use it as a normal website?


I have heard that push notifications are now supported in Chrome (including Android) as a website, but the documents I can find talk about chrome.gcm as only available in a Chrome App or Chrome Extension. What do I do?


Solution

  • chrome.gcm was a proprietary push API built for Chrome Apps and Extensions which the user has to install.

    There is a new API called Push API (spec) which is a web standard based on service workers, and available to normal websites.

    This walkthrough explains how to send notifications from your website and should get you up and running: https://developers.google.com/web/fundamentals/getting-started/push-notifications/