Help

Register a service worker within a custom block

Topic Labels: Custom Extensions
1538 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Fatma_Ali
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi,

I’d like to be able to register a remotely hosted service worker within a custom block in order to activate push notifications. I tried it but I faced cross-origin errors because the iframe is on a different origin from the remote service worker. Any ideas how I could achieve this?

Thanks in advance,
Fatma.

2 Replies 2
Mike_Pennisi
7 - App Architect
7 - App Architect

The going advice is to use importScripts to load cross-origin scripts from the Service Worker:

Unfortunately, this isn’t a complete answer. You’ll still need a way to host a standalone script (that is: the “bootstap” Service Worker script that you register via navigator.serviceWorker.register) in a Block installation, and that’s not currently possible.

The good news is that Custom Blocks is still in beta, so the folks at Airtable are especially receptive to feature requests like this.

Thanks for the response @Mike_Pennisi. Hopefully its something that could be implemented soon :slightly_smiling_face: