I Would Like To Put The File "Service-Worker.Js" In The Root Directory

In fact, I want to incorporate web push notifications into our business. I’m utilising the Firebase Cloud Messaging Service for this.

The “Service-worker.js” file must be uploaded to the root directory in order to receive web push notifications.

Verify the screenshot link at https://www.pikashowhd.com/

Absolutely! While placing “service-worker.js” in the root directory is crucial for Firebase Cloud Messaging to receive web push notifications, remember this alone isn’t enough. Ensure your web app registers the service worker and subscribes to push notifications.

Morever, configure Firebase to send messages targeting the appropriate service worker URL. If you’ve done everything right, your users will soon be receiving your web push notifications! I am saying this in details because I have this practice at my website.

please check this reply

Hi! Could you, please, explain how to register the service worker? I am implementing an app for web push.

I added it through the assets, but I got an error: “The path of the provided scope (‘/’) is not under the max scope allowed (‘/cdn/shop/t/1/assets/’). Adjust the scope, move the Service Worker script, or use the Service-Worker-Allowed HTTP header to allow the scope.”

If I have the correct info, currently, it is impossible to edit the header. I tried to solve the issue by adding the following path to the script: {‘service-worker’: {‘relUrl’: ‘{{ ‘sw.js’ | asset_url }}’} }

I did not receive error then but still the subscribers are not transferred from Shopify to my system. I assume that is because the file was not registered in the root.