How to run service worker locally with Angular

前端 未结 4 1276
小蘑菇
小蘑菇 2021-01-12 15:16

I am following angular\'s best practice in order to make PWA. After making production build (ng build --prod --aot), I am also running the service worker from

4条回答
  •  暖寄归人
    2021-01-12 15:44

    With Chrome, you can enable a flag for treating a specific host as if it is a secure origin, allowing service workers to work:

    ./chrome --unsafely-treat-insecure-origin-as-secure=http://your.insecure.site:8080
    

    To launch chrome from the terminal, you do need to know the executable location. This will be system dependent. For MacOs:

    open /Applications/Google\ Chrome.app/ --args  --unsafely-treat-insecure-origin-as-secure=http://your.insecure.site:8080
    

提交回复
热议问题