diff --git a/src/index.js b/src/index.js index 035280e..bf4b81a 100644 --- a/src/index.js +++ b/src/index.js @@ -10,7 +10,9 @@ function App() { function create() { if ('serviceWorker' in navigator) { - navigator.serviceWorker.register('/ipfs/fetcher.js') + const this_script_url = document.currentScript.src; + const base_script_url = this_script_url.slice(0, this_script_url.lastIndexOf('/')) + navigator.serviceWorker.register(base_script_url + '/fetcher.js') .then((registration) => { console.log('registered the service worker successfully')