且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何请求GCM通过XHR发送通知

更新时间:2023-01-02 22:57:32

您不能。至少不是直接因为GCM API不包含CORS标头,所以不打算在浏览器中使用它。您需要向您自己的服务器发送信号,并复制cURL命令作为该信号的答案。查看我的其他回复:如何发送推送通知在Chrome(Progressive Web Apps)中

You can not. At least, not directly because GCM API does not include CORS headers so it is not intended to be used from the browser. You need to send a signal to your own server and replicate the cURL command as the answer of that signal. See my other response: How to send push notifications in Chrome(Progressive Web Apps)