Disclaimer: I know this is not the intention of web push! Normally there is a backend server which has the vapid keys and sends the http request to FCM. For my use case, security is not a consideration. I just want to know if it's possible to send the request directly to FCM from a different browser tab.
As a quick test, I tried embedding https://github.com/web-push-libs/web-push but the library is intended for nodejs.
For context, I am trying to find a way to send a WebRTC answer to the offering peer without hosting a backend. The goal would be to issue a new vapid private and public key from the offering peer for each new RTCPeerConnection. I could then share the keys by encoding them in an URL which the answering peer could use.
No it's not possible as https://fcm.googleapis.com/fcm/...
does not return the necessary CORS headers. I haven't tested other push services, but they are also unlikely to return CORS headers.