title: Load a webworker based on the relative path of the caller when the caller is embedded in a Html file
body: <p>I have 2 javascript files. One is named "index.js" and the other "worker.js".</p>
  
  <p>index.js will be embedded into all the pages of my website (meaning different hierarchy's). I need to call "worker.js" from index.js when any of these pages are loaded. </p>
  
  <p>The problem is index.js thinks its own path is the path of the page it's embedded in. So if my file directory looks like this:</p>
  
  <pre><code>index.html
  ├───JS
  │   ├───index.js
  │   ├───worker.js
  ├───otherPage
  │   ├───newPage.html
  </code></pre>
  
  <p>When I'm in the "index.html" file I can use the path "JS/worker.js" to load the worker from index.js.</p>
  
  <p>However, when I'm in "newPage.html" I would need to use the path "../JS/worker.js" to load the worker. </p>
  
  <p>This means each time "index.js" is placed on a page it would have to be edited to find the location of worker.js. How can I avoid this and use the local path of "index.js" to resolve the path of worker.js against?</p>