Web Push Notifications for most browsers (not Safari) require Service Worker file(s) to be available on your domain in order to subscribe and receive web push notifications.
These files generally get downloaded upon accepting to receive push notifications.
Skip if using our WordPress or Shopify Plugins
The iZooto Service Worker file gets added automatically through our plugins, and you should not add these files to your website manually.
You can download the zip file from the iZooto dashboard under Settings > Setup > Install > Step 2. The downloaded zip contains the iZooto Service Worker file.
You can place the
service-worker.js file on your website's root directory or in a sub-directory path you will never link users to.
If you place the file in a sub-directory path, they will not conflict with any other Service Workers you have now or may add in the future.
- Example sub-directory path:
The sub-directory path needs to be defined on the iZooto panel under Settings > Setup > Install > Step 2 > Don't have access to root directory.
These files should be put in a permanent location that will never change! Once a ServiceWorker is registered with the browser, it is very difficult to change.
If you are unsure how to upload files to your server, some common options are as given below:
|- Use an FTP Server like FileZilla to upload the files to the root directory of your website.
- Here is a step-by-step guide.
|- Use your hosting provider's control panel like cPanel to upload files.
|Contact your Hosting Provider
|- Most hosting providers will be more than happy to assist you in uploading files to your website.
- Just send them the zip file and ask them to unzip it in your website's root directory.
|What if I can't upload
.js files to my domain at all?
Almost done! You now need to tell iZooto where to find this Service Worker file.
If you placed them in your site's root directory, then you are done if they are accessible publicly at:
If you placed them in a sub-directory path, ensure you define the sub-directory path on the iZooto panel under Settings > Setup > Install > Step 2 > Don't have access to root directory.
Multiple Service Workers on Root Directory
It is recommended that the Service Worker is always hosted on the root directory of the website. If you already have an existing service worker on the root directory, you can append the iZooto's ServiceWorker's contents to the existing service worker file and communicate the same to the iZooto Solutions team.
Additionally, if there is a need to change the name of the ServiceWorker file, the same should be communicated to iZooto Solutions team immediately so that the appropriate changes can be done to the backend configuration.
You have successfully configured iZooto's Service Worker to push web notifications.
Updated about 2 years ago