chrome web worker

Chrome with Webworker

If I try to use web workers through a JavaScript file, Chrome throws an error -

Uncaught SecurityError: Failed to create a worker: script at '(path)/worker.js' cannot be accessed from origin 'null'.

The solution is to set up a python server in this path.

python -m http.server 8888

Then it works fine.