如何请求GCM通过XHR发送通知 [英] how to make a request to GCM to send a notification via XHR
问题描述
实际上,我想向GCM发送请求以通过XHR发送通知
我已经使用cURL实用程序向GCM发送了请求,但是我不知道如何使用XHR进行操作。有没有办法做到这一点
actually i want to make a request to GCM to send a notification through XHR I already make request to GCM using the cURL utility but i don't know how to do it with XHR. Is there any way to do that
推荐答案
您不能。至少不是直接因为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)
这篇关于如何请求GCM通过XHR发送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!