ソースを参照

fix(pwa) fix loading the service worker

We typically use a base URL for static assets using a CDN so loading the worker
from there won't work since it's a different origin. Using a URL relative to the
origin of the page will make it be loaded from the right place.
master
Saúl Ibarra Corretgé 5年前
コミット
d5b2da02c1
1個のファイルの変更2行の追加2行の削除
  1. 2
    2
      index.html

+ 2
- 2
index.html ファイルの表示

25
 
25
 
26
             if (shouldRegisterWorker) {
26
             if (shouldRegisterWorker) {
27
                 navigator.serviceWorker
27
                 navigator.serviceWorker
28
-                    .register('pwa-worker.js')
28
+                    .register('/pwa-worker.js')
29
                     .then(reg => {
29
                     .then(reg => {
30
                         console.log('Service worker registered.', reg);
30
                         console.log('Service worker registered.', reg);
31
                     })
31
                     })
33
                         console.log(err);
33
                         console.log(err);
34
                     });
34
                     });
35
             }
35
             }
36
-        })
36
+        });
37
     </script>
37
     </script>
38
     <script>
38
     <script>
39
         // IE11 and earlier can be identified via their user agent and be
39
         // IE11 and earlier can be identified via their user agent and be

読み込み中…
キャンセル
保存