Search code examples
angularangular-service-worker

Could not subscribe to notifications Error: Service workers are disabled or not supported by this browser


I am following the steps that are given in https://blog.angular-university.io/angular-push-notifications/#:~:text=Push%20Notification%20Demo,a%20Notification%20to%20the%20user.

I am trying to get push notification using angular. But while getting the push notification, I got an error

enter image description here

I have done the service worker setup. But don't know why this error is coming


Solution

  • Service workers doesn't work with ng serve. use http-server like below :-

    First install a http-server

    npm i -g http-server
    

    Build your project

    ng build --prod
    

    Inside dist run

    http-server