how to make a request to GCM to send a notification via XHR

浪尽此生 提交于 2019-12-10 12:01:03

问题


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


回答1:


Good news! There's a dedicated page as well as a demo of your inquiry in the documentation!




回答2:


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)



来源:https://stackoverflow.com/questions/36662561/how-to-make-a-request-to-gcm-to-send-a-notification-via-xhr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!